[New-bugs-announce] [issue12337] Need real TextIOWrapper for stdin/stdout

Fan Decheng report at bugs.python.org
Wed Jun 15 06:59:53 CEST 2011

New submission from Fan Decheng <fandecheng at gmail.com>:

Since "-u" is made default and binary stdio implemented in 3.2, many of my scripts cannot run directly in Python 3.2, because they expect "\n" from stdin, but on Windows "\r\n" is got.

Since that binary stdio being default is necessary for features like CGI, what I am expecting is to get a real TextIOWrapper for stdin, so that I can still use my old code. Besides, type(sys.stdio) should no longer say TextIOWrapper, because TextIOWrapper implies the conversion from "\r\n" to "\n".

Steps to reproduce:
In Python 3.2:
>>> import sys
>>> type(sys.stdin)
<class '_io.TextIOWrapper'>
>>> sys.stdin.readline()
>>> type(sys.stdout)
<class '_io.TextIOWrapper'>

Expected result:
There should be some form of text support, such as textstream(sys.stdin).readline(). Also type(sys.stdin) should not say something like "TextIOWrapper". Same for sys.stdout.

components: IO
messages: 138356
nosy: r_mosaic
priority: normal
severity: normal
status: open
title: Need real TextIOWrapper for stdin/stdout
type: behavior
versions: Python 3.2

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list