From cafaf0447b950fd4f59edd8cbde040c61ae528f8 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 13 Jul 2018 11:26:03 -0400 Subject: bpo-34108: Fix double carriage return in 2to3 on Windows (#8271) * Add test capturing failure. * Honor newlines as present in the original file. --- Lib/lib2to3/refactor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Lib/lib2to3/refactor.py') diff --git a/Lib/lib2to3/refactor.py b/Lib/lib2to3/refactor.py index 7c4e064997..7841b99a5c 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 -- cgit v1.2.1