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

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


http://hg.python.org/cpython/rev/2a4c083f8f6b
changeset:   88181:2a4c083f8f6b
parent:      88178:8a334a509dc2
parent:      88180:8f75d8ddc95b
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Wed Dec 25 14:27:16 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
@@ -1384,6 +1384,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
@@ -240,6 +240,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