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

Prototype to test nonblocking file objet:
 - add getblocking() and setblocking() methods to _io._FileIO and all _pyio 
classes
 - fileio_setblocking() is implemented using fcntl(fd, F_SETFL, flags | 
O_NONBLOCK) (POSIX only?)
 - BufferedReader.read() uses read1() if the file is blocking

Use test_process.py to test it: this script runs a Python interpreter in a 
subprocess. It uses select() to check if there is data or not. Eg. type '1+1\n' 
and then 'exit()\n'. Set PYIO_HAVE_BLOCKING constant to False (in 
test_process.py) to test the script without io_blocking.patch.

I'm not sure that select() is required, but it doesn't work without it (read() 
blocks).

----------
keywords: +patch
nosy: +haypo
Added file: http://bugs.python.org/file19384/io_blocking.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue949667>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to