[Python-Dev] PEP 3145 (With Contents)
Gregory P. Smith
greg at krypto.org
Sun Dec 9 05:37:37 CET 2012
On Sat, Dec 8, 2012 at 8:14 PM, Glyph <glyph at twistedmatrix.com> wrote:
> On Dec 7, 2012, at 5:10 PM, anatoly techtonik <techtonik at gmail.com> wrote:
> What about reading from other file descriptors? subprocess.Popen allows
>> arbitrary file descriptors to be used. Is there any provision here for
>> reading and writing non-blocking from or to those?
> On Windows it is WriteFile/ReadFile and PeekNamedPipe. On Linux it is
> select. Of course a test is needed, but why it should not just work?
> This is exactly why the provision needs to be made explicitly.
> On Windows it is WriteFile and ReadFile and PeekNamedPipe - unless the
> handle is a socket in which case it needs to be WSARecv. Or maybe it's
> some other weird thing - like, maybe a mailslot - and you need to call a
> different API.
> On *nix it really shouldn't be select. select cannot wait upon a file
> descriptor whose *value* is greater than FD_SETSIZE, which means it sets
> a hard (and small) limit on the number of things that a process which wants
> to use this facility can be doing.
Nobody should ever touch select() this decade. poll() exists everywhere
> On the other hand, if you hard-code another arbitrary limit like this into
> the stdlib subprocess module, it will just be another great reason why
> Twisted's spawnProcess is the best and everyone should use it instead, so
> be my guest ;-).
Is twisted's spawnProcess thread safe and async signal safe by using
restricted C code for everything between the fork() and exec()? I'm not
familiar enough with the twisted codebase to find things easily in it but
I'm not seeing such an extension module within twisted and the code in
is not safe. Just sayin'. :)
Python >= 3.2 along with the
http://pypi.python.org/pypi/subprocess32/backport for use on 2.x get
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev