summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/IOBinding.py
diff options
context:
space:
mode:
authorKurt B. Kaiser <kbk@shore.net>2007-10-09 23:12:31 (GMT)
committerKurt B. Kaiser <kbk@shore.net>2007-10-09 23:12:31 (GMT)
commit3e623ba3ec0e1fc0491cdf6487b42c652d616ca6 (patch)
treeb599dfd9efc5f1c523267a6f4fd05d922a7c46b8 /Lib/idlelib/IOBinding.py
parente518bf3c49b9d43f99511516a36cd363649cc44e (diff)
downloadcpython-3e623ba3ec0e1fc0491cdf6487b42c652d616ca6.zip
cpython-3e623ba3ec0e1fc0491cdf6487b42c652d616ca6.tar.gz
cpython-3e623ba3ec0e1fc0491cdf6487b42c652d616ca6.tar.bz2
Windows EOL sequence not converted correctly, encoding error.
Caused file save to fail. Bug 1130. M idlelib/IOBinding.py M idlelib/NEWS.txt
Diffstat (limited to 'Lib/idlelib/IOBinding.py')
-rw-r--r--Lib/idlelib/IOBinding.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/idlelib/IOBinding.py b/Lib/idlelib/IOBinding.py
index cde2dae..5a15995 100644
--- a/Lib/idlelib/IOBinding.py
+++ b/Lib/idlelib/IOBinding.py
@@ -242,7 +242,6 @@ class IOBinding:
eol = r"(\r\n)|\n|\r" # \r\n (Windows), \n (UNIX), or \r (Mac)
eol_re = re.compile(eol)
- eol_convention = os.linesep # Default
def loadfile(self, filename):
try:
@@ -389,9 +388,10 @@ class IOBinding:
def writefile(self, filename):
self.fixlastline()
- chars = self.encode(self.text.get("1.0", "end-1c"))
+ text = self.text.get("1.0", "end-1c")
if self.eol_convention != "\n":
- chars = chars.replace("\n", self.eol_convention)
+ text = text.replace("\n", self.eol_convention)
+ chars = self.encode(self.text.get("1.0", "end-1c"))
try:
f = open(filename, "wb")
f.write(chars)