From: Serhiy Storchaka Date: Wed, 25 Dec 2013 12:24:17 +0000 (+0200) Subject: Issue #20058: sys.stdin.readline() in IDLE now always returns only one line. X-Git-Tag: v2.7.8~168 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0b6b335253949df26c369ecce35199e9dc2b86f5;p=python Issue #20058: sys.stdin.readline() in IDLE now always returns only one line. --- diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py index be64acaf90..dc3cfe6120 100755 --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -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] diff --git a/Misc/NEWS b/Misc/NEWS index 4a780020fe..3e861f8b45 100644 --- 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.