[Python-Dev] Help to fix this bug http://bugs.python.org/issue15068 (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Tue Jun 19 14:13:29 CEST 2012
- Previous message: [Python-Dev] Help to fix this bug http://bugs.python.org/issue15068
- Next message: [Python-Dev] Help to fix this bug http://bugs.python.org/issue15068
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
On Tue, 19 Jun 2012 04:39:30 -0700 (PDT) gmspro <gmspro at yahoo.com> wrote:
Hi,
I'm working on this bug to fix it. http://bugs.python.org/issue15068
I'm not sure why you think this is fixable, given the comments on the tracker. What is your plan?
>>> from sys import stdin >>> str=stdin.read() hello hello world CTRL+D CTRL+D
Can anyone tell me where is stdin.read() function defined? Or where is sys.stdin defined?
Can I suggest you try to investigate it a bit yourself:
sys.stdin <_io.TextIOWrapper name='' mode='r' encoding='UTF-8'>
So it's a TextIOWrapper from the _io module (which is really the implementation of the io module). You'll find its source in Modules/_io. TextIOWrapper objects are defined in Modules/_io/textio.c. But as you know, they wrap buffered I/O objects, which are defined in Modules/_io/bufferedio.c. In sys.stdin's case, the buffered I/O object wraps a raw FileIO object, defined in Modules/_io/fileio.c:
sys.stdin.buffer <_io.BufferedReader name=''> sys.stdin.buffer.raw <_io.FileIO name='' mode='rb'>
Regards
Antoine.
- Previous message: [Python-Dev] Help to fix this bug http://bugs.python.org/issue15068
- Next message: [Python-Dev] Help to fix this bug http://bugs.python.org/issue15068
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]