mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
bpo-34108: Fix double carriage return in 2to3 on Windows (#8271)
* Add test capturing failure. * Honor newlines as present in the original file.
This commit is contained in:
parent
379e9d639a
commit
cafaf0447b
3 changed files with 3 additions and 1 deletions
|
@ -514,7 +514,7 @@ class RefactoringTool(object):
|
||||||
set.
|
set.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
fp = io.open(filename, "w", encoding=encoding)
|
fp = io.open(filename, "w", encoding=encoding, newline='')
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
self.log_error("Can't create %s: %s", filename, err)
|
self.log_error("Can't create %s: %s", filename, err)
|
||||||
return
|
return
|
||||||
|
|
|
@ -300,6 +300,7 @@ from __future__ import print_function"""
|
||||||
old, new = self.refactor_file(fn)
|
old, new = self.refactor_file(fn)
|
||||||
self.assertIn(b"\r\n", old)
|
self.assertIn(b"\r\n", old)
|
||||||
self.assertIn(b"\r\n", new)
|
self.assertIn(b"\r\n", new)
|
||||||
|
self.assertNotIn(b"\r\r\n", new)
|
||||||
|
|
||||||
def test_refactor_docstring(self):
|
def test_refactor_docstring(self):
|
||||||
rt = self.rt()
|
rt = self.rt()
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Remove extraneous CR in 2to3 refactor.
|
Loading…
Add table
Add a link
Reference in a new issue