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 be64aca..dc3cfe6 100755
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -1393,6 +1393,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
index 4a78002..3e861f8 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -118,6 +118,8 @@
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.