[issue11459] Python select.select does not correctly report read readyness
Charles-Francois Natali
report at bugs.python.org
Thu Mar 10 09:12:26 CET 2011
Charles-Francois Natali <neologix at free.fr> added the comment:
Could you try with the attached patch ?
The problem is that subprocess silently replaces bufsize=0, so child.stdout is actually buffered, and when you read just one byte, everything that's available for reading is read into the python's object buffer. Then, select/poll doesn't see the pipe as ready for reading since everything as already been read.
Mixing buffered I/O and select leads to trouble, you're right to pass bufsize=0, but I don't know why subprocess goes out of its way and buffers it anyway:
if bufsize == 0:
bufsize = 1 # Nearly unbuffered (XXX for now)
----------
keywords: +patch
nosy: +neologix
Added file: http://bugs.python.org/file21068/subprocess_buffer.diff
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11459>
_______________________________________
More information about the Python-bugs-list
mailing list