Author haypo
Recipients SilentGhost, brian.curtin, duncanb, ezio.melotti, georg.brandl, haypo, pitrou, v+python
Date 2011-02-23.01:11:05
SpamBayes Score 3.92157e-11
Marked as misclassified No
Message-id <1298423466.25.0.989389940533.issue11272@psf.upfronthosting.co.za>
In-reply-to
Content
C:\Python32>python
    Python 3.2 ... on win32
    >>> import sys
    >>> for line in sys.stdin:
    ...     print(repr(line))
    ...
    hello
    'hello\r\n'
    ^Z

Oh yes, I confirm that there is a second bug: sys.stdin doesn't translate \r\n to \n, whereas sys.stdin is a text file.

Attached patch fixes both issues.

> Is it possible to add some tests for input()?

input() has already tests, but the bug was not detected because the test uses a mockup, not a subprocess. Moreover, I don't think that it is possible to test input() for the TTY case. It is not easy to test a TTY, especially on Windows.

If anyone knows how to reproduce the two bugs with a short Python script, I can try to convert it into a test.

> Also the patch uses tabs instead of spaces.

Yeah, I hate producing patches on Windows. Fixed in the new patch (prepared on Linux).
History
Date User Action Args
2011-02-23 01:11:06hayposetrecipients: + haypo, duncanb, georg.brandl, pitrou, ezio.melotti, v+python, brian.curtin, SilentGhost
2011-02-23 01:11:06hayposetmessageid: <1298423466.25.0.989389940533.issue11272@psf.upfronthosting.co.za>
2011-02-23 01:11:05haypolinkissue11272 messages
2011-02-23 01:11:05haypocreate