[New-bugs-announce] [issue11272] input() has trailing carriage return on windows

Duncan Booth report at bugs.python.org
Mon Feb 21 16:48:24 CET 2011


New submission from Duncan Booth <kupuguy at gmail.com>:

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 <report at bugs.python.org>
<http://bugs.python.org/issue11272>
_______________________________________


More information about the New-bugs-announce mailing list