From: Serhiy Storchaka Date: Wed, 25 Dec 2013 12:24:35 +0000 (+0200) Subject: Issue #20058: sys.stdin.readline() in IDLE now always returns only one line. X-Git-Tag: v3.4.0b2~93^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0fd557647d9957542a68972854a227d2def5f5f3;p=thirdparty%2FPython%2Fcpython.git 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 6674f4ecdda1..55fd3574d4f1 100755 --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -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] diff --git a/Misc/NEWS b/Misc/NEWS index 8dddb6afe647..f9db232016d2 100644 --- 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