[issue11272] input() has trailing carriage return on windows

2011-05-25 Thread R. David Murray

R. David Murray  added the comment:

You are using the only version that has the bug (3.2.0, also called 3.2).  The 
fixed version will be released shortly (3.2.1).

--
nosy: +r.david.murray

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11272] input() has trailing carriage return on windows

2011-05-25 Thread Giuseppe Laurenza

Giuseppe Laurenza  added the comment:

I'm using the 3.2,
the 3.0 has the bug?

2011/5/25 STINNER Victor 

>
> STINNER Victor  added the comment:
>
> > On my pc with both architecture (x86 and x64) the bug
> > is still presentes
>
> Which version of Python are you using? Python 3.1, Python 3.2.1 and Python
> 3.3 doesn't have the bug, Python 3.2.0 has the bug. Python 3.2.1 doesn't
> have the bug, but it's not released yet: it will be released in a few weeks.
> Python 3.3 is a development version.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--
Added file: http://bugs.python.org/file22104/unnamed

___
Python tracker 

___I'm using the 3.2,the 3.0 has the bug?2011/5/25 STINNER Victor rep...@bugs.python.org>

STINNER Victor victor.stin...@haypocalc.com> 
added the comment:

> On my pc with both architecture (x86 and x64) the bug
> is still presentes

Which version of Python are you using? Python 3.1, Python 3.2.1 and 
Python 3.3 doesn't have the bug, Python 3.2.0 has the bug. Python 3.2.1 
doesn't have the bug, but it's not released yet: it will be released in 
a few weeks. Python 3.3 is a development version.


--

___
Python tracker rep...@bugs.python.org>
http://bugs.python.org/issue11272>
___

___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11272] input() has trailing carriage return on windows

2011-05-25 Thread STINNER Victor

STINNER Victor  added the comment:

> On my pc with both architecture (x86 and x64) the bug
> is still presentes

Which version of Python are you using? Python 3.1, Python 3.2.1 and Python 3.3 
doesn't have the bug, Python 3.2.0 has the bug. Python 3.2.1 doesn't have the 
bug, but it's not released yet: it will be released in a few weeks. Python 3.3 
is a development version.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11272] input() has trailing carriage return on windows

2011-05-25 Thread Giuseppe Laurenza

Giuseppe Laurenza  added the comment:

On my pc with both architecture (x86 and x64) the bug is still presentes

--
nosy: +Phoenix Fire

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11272] input() has trailing carriage return on windows

2011-02-23 Thread STINNER Victor

STINNER Victor  added the comment:

Fixed in 3.3 (r88530) and 3.2 (r88531). Others versions are not affected.

Thanks Duncan Booth, I added tests based on your stdintests.py script. I used 
directly stdin argument of Popen() instead of using cmd.exe to create the pipe 
(which is not portable).

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11272] input() has trailing carriage return on windows

2011-02-23 Thread Duncan Booth

Duncan Booth  added the comment:

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

If you don't mind kicking off some sub-processes then here's a script that 
shows the bugs.

I couldn't figure out how to do a script that would work on Python 3.1 but fail 
on Python 3.2, because I think to show the problem you have to use the shell to 
pipe data and Popen on Python 3.1 quotes the pipe character.

--
Added file: http://bugs.python.org/file20857/stdintests.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11272] input() has trailing carriage return on windows

2011-02-22 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file20852/input_rn.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11272] input() has trailing carriage return on windows

2011-02-22 Thread STINNER Victor

STINNER Victor  added the comment:

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).

--
Added file: http://bugs.python.org/file20853/issue11272.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11272] input() has trailing carriage return on windows

2011-02-22 Thread Ezio Melotti

Ezio Melotti  added the comment:

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

Also the patch uses tabs instead of spaces.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11272] input() has trailing carriage return on windows

2011-02-22 Thread STINNER Victor

STINNER Victor  added the comment:

Here is a patch to fix input() on Windows: strip also \r.

--
keywords: +patch
Added file: http://bugs.python.org/file20852/input_rn.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11272] input() has trailing carriage return on windows

2011-02-21 Thread Duncan Booth

Duncan Booth  added the comment:

Yes, it does indeed look like stdin has been opened in binary mode. Just 
iterating over it also gives the spurious carriage returns:


C:\Python32>python
Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] 
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> for line in sys.stdin:
... print(repr(line))
...
hello
'hello\r\n'
^Z
>>>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11272] input() has trailing carriage return on windows

2011-02-21 Thread SilentGhost

SilentGhost  added the comment:

> Can you try Python 3.1 with -u command line flag?
Yes, I can reproduce it with 3.1.3 with -u flag

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11272] input() has trailing carriage return on windows

2011-02-21 Thread STINNER Victor

STINNER Victor  added the comment:

> Confirmed on Python 3.2 (winxp).
> The problem doesn't seem to exist on 3.1.3.

Can you try Python 3.1 with -u command line flag?

I changed Python 3.2 to always open all files in binary module, not only if -u 
flag is used. I had also to fix the parser to support \r\n newlines: it looks 
like I missed something in the parser.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11272] input() has trailing carriage return on windows

2011-02-21 Thread Georg Brandl

Changes by Georg Brandl :


--
keywords: +3.2regression

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11272] input() has trailing carriage return on windows

2011-02-21 Thread SilentGhost

Changes by SilentGhost :


--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11272] input() has trailing carriage return on windows

2011-02-21 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +pitrou, v+python

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11272] input() has trailing carriage return on windows

2011-02-21 Thread Brian Curtin

Brian Curtin  added the comment:

#10841 may be related.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11272] input() has trailing carriage return on windows

2011-02-21 Thread SilentGhost

SilentGhost  added the comment:

With py3.2 final, I can reproduce this bug with command line (as demonstrated 
by the OP) but not with the IDLE (for 3.2a4+ I have only command line, which I 
compiled myself).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11272] input() has trailing carriage return on windows

2011-02-21 Thread SilentGhost

SilentGhost  added the comment:

On WinXp with Python 3.2a4+ or 3.1.3 I cannot reproduce this issue.

--
nosy: +SilentGhost

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11272] input() has trailing carriage return on windows

2011-02-21 Thread Brian Curtin

Changes by Brian Curtin :


--
nosy: +brian.curtin

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11272] input() has trailing carriage return on windows

2011-02-21 Thread Ezio Melotti

Ezio Melotti  added the comment:

Confirmed on Python 3.2 (winxp). The problem doesn't seem to exist on 3.1.3.

--
priority: normal -> critical
stage:  -> test needed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11272] input() has trailing carriage return on windows

2011-02-21 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti, georg.brandl

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11272] input() has trailing carriage return on windows

2011-02-21 Thread Duncan Booth

New submission from Duncan Booth :

In Python 3.2, the builtin function `input()` returns a string with a trailing 
'\r' on windows:

C:\Python32>python
Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] 
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print(repr(input()))
test
'test\r'
>>>

This breaks code that expects the string to be stripped, e.g. 'pydoc.py -b' 
doesn't recognise its commands:

C:\Python32>python lib\pydoc.py -b
Server ready at http://localhost:4680/
Server commands: [b]rowser, [q]uit
server> q
Server commands: [b]rowser, [q]uit
server> b
Server commands: [b]rowser, [q]uit
server>

--
components: Interpreter Core, Windows
messages: 128964
nosy: duncanb
priority: normal
severity: normal
status: open
title: input() has trailing carriage return on windows
type: behavior
versions: Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com