bpo-11594: Ensure line-endings are respected when using 2to3 (GH-6483)

This commit is contained in:
Aaron Ang 2018-04-17 14:34:14 -07:00 committed by Łukasz Langa
parent 36d56ea826
commit c127a86e18
4 changed files with 35 additions and 18 deletions

View file

@ -314,7 +314,7 @@ class RefactoringTool(object):
encoding = tokenize.detect_encoding(f.readline)[0]
finally:
f.close()
with io.open(filename, "r", encoding=encoding) as f:
with io.open(filename, "r", encoding=encoding, newline='') as f:
return f.read(), encoding
def refactor_file(self, filename, write=False, doctests_only=False):