diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/lib2to3/refactor.py | 2 | ||||
-rw-r--r-- | Lib/lib2to3/tests/test_refactor.py | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/Lib/lib2to3/refactor.py b/Lib/lib2to3/refactor.py index 7c4e064..7841b99 100644 --- a/Lib/lib2to3/refactor.py +++ b/Lib/lib2to3/refactor.py @@ -514,7 +514,7 @@ class RefactoringTool(object): 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 diff --git a/Lib/lib2to3/tests/test_refactor.py b/Lib/lib2to3/tests/test_refactor.py index f3059a9..9e3b8fb 100644 --- a/Lib/lib2to3/tests/test_refactor.py +++ b/Lib/lib2to3/tests/test_refactor.py @@ -300,6 +300,7 @@ from __future__ import print_function""" 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() |