Skip to content
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

bpo-41373: IDLE: Fix saving files loaded with no newlines or mixed newlines #21597

Merged
merged 4 commits into from
Jul 25, 2020
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
11 changes: 11 additions & 0 deletions Lib/idlelib/iomenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,17 @@ def loadfile(self, filename):
parent=self.text)
return False

if not isinstance(eol_convention, str):
# If the file does not contain line separators, it is None.
# If the file contains mixed line separators, it is a tuple.
if eol_convention is not None:
tkMessageBox.showwarning("Mixed Newlines",
"Mixed newlines detected.\n"
"The file will be changed on save.",
parent=self.text)
converted = True
eol_convention = os.linesep # default

self.text.delete("1.0", "end")
self.set_filename(None)
self.fileencoding = fileencoding
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Save files loaded with no line ending, as when blank, or different line
endings, by setting its line ending to the system default. Fix regression in
3.8.4 and 3.9.0b4.