]> granicus.if.org Git - python/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:17 +0000 (14:24 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Wed, 25 Dec 2013 12:24:17 +0000 (14:24 +0200)
Lib/idlelib/PyShell.py
Misc/NEWS

index be64acaf904e7041259c920622c5ab2cb0564dbe..dc3cfe6120b6822e971bbf11c4deb9f6dc971659 100755 (executable)
@@ -1393,6 +1393,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 4a780020fe311ba4b04c1d185d34ff9aa0e0e09d..3e861f8b45e6f52a879bd35b270a70551be47bb3 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -118,6 +118,8 @@ Library
 IDLE
 ----
 
+- Issue #20058: sys.stdin.readline() in IDLE now always returns only one line.
+
 - Issue #19481: print() of unicode, str or bytearray subclass instance in IDLE
   no more hangs.