Commit cafaf044 authored by Jason R. Coombs's avatar Jason R. Coombs Committed by GitHub

bpo-34108: Fix double carriage return in 2to3 on Windows (#8271)

* Add test capturing failure.
* Honor newlines as present in the original file.
parent 379e9d63
......@@ -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
......
......@@ -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()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment