summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/iomenu.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-07-25 03:39:31 (GMT)
committerGitHub <noreply@github.com>2020-07-25 03:39:31 (GMT)
commit15fdbb7145ee99abd98b4968307d4b89dd71a988 (patch)
tree26cc305873315e8845f74614a025555abea0f785 /Lib/idlelib/iomenu.py
parentba07d4a0c30b4d817b4c31a052388a68cc17bc3b (diff)
downloadcpython-15fdbb7145ee99abd98b4968307d4b89dd71a988.zip
cpython-15fdbb7145ee99abd98b4968307d4b89dd71a988.tar.gz
cpython-15fdbb7145ee99abd98b4968307d4b89dd71a988.tar.bz2
bpo-41373: IDLE: Fix saving files loaded with no newlines or mixed newlines (GH-21597)
Fixes regression in 3.8.4 and 3.9.0b4. Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> (cherry picked from commit 0dd463c8a4269137ebed7cc29605c555030df94f) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Lib/idlelib/iomenu.py')
-rw-r--r--Lib/idlelib/iomenu.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/idlelib/iomenu.py b/Lib/idlelib/iomenu.py
index 74ebefd..8bb2fa6 100644
--- a/Lib/idlelib/iomenu.py
+++ b/Lib/idlelib/iomenu.py
@@ -155,6 +155,17 @@ class IOBinding:
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