]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #20058: sys.stdin.readline() in IDLE now always returns only one line.
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 25 Dec 2013 12:24:35 +0000 (14:24 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Wed, 25 Dec 2013 12:24:35 +0000 (14:24 +0200)
Lib/idlelib/PyShell.py
Misc/NEWS

index 6674f4ecdda1805d53828597134fda32eaf8c29f..55fd3574d4f13fca0663f063373fc6226ce6d021 100755 (executable)
@@ -1381,6 +1381,9 @@ class PseudoInputFile(PseudoFile):
         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]
 
index 8dddb6afe647b84d12ef490b493c20d158744489..f9db232016d2309fa2df9da586d404ab77621f39 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -169,6 +169,8 @@ Library
 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