[Python-bugs-list] [ python-Bugs-470634 ] readlines() on linux requires 2 ^D's (original) (raw)
noreply@sourceforge.net noreply@sourceforge.net
Fri, 12 Oct 2001 10:06:50 -0700
- Previous message: [Python-bugs-list] [ python-Bugs-470633 ] segfault with 2.2a4
- Next message: [Python-bugs-list] [ python-Bugs-470635 ] simple script causes segfault
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Bugs item #470634, was opened at 2001-10-12 10:06 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=105470&aid=470634&group_id=5470
Category: Python Interpreter Core Group: Platform-specific Status: Open Resolution: None Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: readlines() on linux requires 2 ^D's
Initial Comment: Platform:
This bug has been confirmed on Python 1.5.2, 2.0.1, and 2.1.1 running on Debian Linux 2.2 w/kernel 2.4.9 and libc6 2.2.4, as well as Python 1.5.2 running on Debian Linux 2.0 w/kernel 2.0.38 and libc6 2.0.7.
It has been found not to happen with Python 2.1.1 on Solaris 8 and Cygwin.
Bug Description: When using the standard idiom:
for line in sys.stdin.readlines(): print line
...to loop through lines submitted to stdin, and providing that input interactively (i.e. typing at the console), it is necessary to press ^D twice at the start of line of input to terminate input. The behavior can be noticed both in python's interactive mode and when running a script. Redirected input does not show this problem, that is if the above lines are contained in myscript.py, and you execute:
cat | myscript.py
A single ^D is sufficient to terminate inputs.
Also, the problem is unique to the "readlines()" method. If you code the loop as
for line in sys.stdin.read().splitlines():
then a single ^D at the beginning of a line is sufficient to terminate input.
You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=105470&aid=470634&group_id=5470
- Previous message: [Python-bugs-list] [ python-Bugs-470633 ] segfault with 2.2a4
- Next message: [Python-bugs-list] [ python-Bugs-470635 ] simple script causes segfault
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]