[Python-checkins] cpython (3.3): Issue #20058: sys.stdin.readline() in IDLE now always returns only one line.

serhiy.storchaka python-checkins at python.org
Wed Dec 25 13:25:35 CET 2013


http://hg.python.org/cpython/rev/8f75d8ddc95b
changeset: 88180:8f75d8ddc95b
branch: 3.3
parent: 88160:99190ebd4935
user: Serhiy Storchaka <storchaka at gmail.com>
date: Wed Dec 25 14:24:35 2013 +0200
summary:
 Issue #20058: sys.stdin.readline() in IDLE now always returns only one line.
files:
 Lib/idlelib/PyShell.py | 3 +++
 Misc/NEWS | 2 ++
 2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -1381,6 +1381,9 @@
 line = self._line_buffer or self.shell.readline()
 if size < 0:
 size = len(line)
+ eol = line.find('\n', 0, size)
+ if eol >= 0:
+ size = eol + 1
 self._line_buffer = line[size:]
 return line[:size]
 
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -169,6 +169,8 @@
 IDLE
 ----
 
+- Issue #20058: sys.stdin.readline() in IDLE now always returns only one line.
+
 - Issue #19481: print() of string subclass instance in IDLE no longer hangs.
 
 - Issue #18270: Prevent possible IDLE AttributeError on OS X when no initial
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /