From 62558eee66cac290c815ced40f16da02e717235e Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 13 Jul 2018 08:34:00 -0400 Subject: [PATCH 1/3] bpo-34108: Add test capturing failure. --- Lib/lib2to3/tests/test_refactor.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/lib2to3/tests/test_refactor.py b/Lib/lib2to3/tests/test_refactor.py index f3059a93113b1c..9e3b8fbb90b2f3 100644 --- a/Lib/lib2to3/tests/test_refactor.py +++ b/Lib/lib2to3/tests/test_refactor.py @@ -300,6 +300,7 @@ def test_crlf_unchanged(self): old, new = self.refactor_file(fn) self.assertIn(b"\r\n", old) self.assertIn(b"\r\n", new) + self.assertNotIn(b"\r\r\n", new) def test_refactor_docstring(self): rt = self.rt() From bdd249c68f7552a408460c21509795f911cde201 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 13 Jul 2018 08:38:47 -0400 Subject: [PATCH 2/3] bpo-34108: Honor newlines as present in the original file. --- Lib/lib2to3/refactor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/lib2to3/refactor.py b/Lib/lib2to3/refactor.py index 7c4e0649975cec..7841b99a5cd4c1 100644 --- a/Lib/lib2to3/refactor.py +++ b/Lib/lib2to3/refactor.py @@ -514,7 +514,7 @@ def write_file(self, new_text, filename, old_text, encoding=None): set. """ try: - fp = io.open(filename, "w", encoding=encoding) + fp = io.open(filename, "w", encoding=encoding, newline='') except OSError as err: self.log_error("Can't create %s: %s", filename, err) return From 39750ab503e05f576eaec51b901afee691447fff Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 13 Jul 2018 08:54:14 -0400 Subject: [PATCH 3/3] bpo-34108: add blurb --- .../NEWS.d/next/Library/2018-07-13-08-44-52.bpo-34108.RjobUC.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2018-07-13-08-44-52.bpo-34108.RjobUC.rst diff --git a/Misc/NEWS.d/next/Library/2018-07-13-08-44-52.bpo-34108.RjobUC.rst b/Misc/NEWS.d/next/Library/2018-07-13-08-44-52.bpo-34108.RjobUC.rst new file mode 100644 index 00000000000000..1021f98b7f9e20 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2018-07-13-08-44-52.bpo-34108.RjobUC.rst @@ -0,0 +1 @@ +Remove extraneous CR in 2to3 refactor. pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy