8000 bpo-34108: Fix double carriage return in 2to3 on Windows by jaraco · Pull Request #8271 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lib/lib2to3/refactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ def write_file(self, new_text, filename, old_text, encoding=None):
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
Expand Down
1 change: 1 addition & 0 deletions Lib/lib2to3/tests/test_refactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ def test_crlf_unchanged(self):
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()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove extraneous CR in 2to3 refactor.
0