[issue1191964] asynchronous Subprocess

akira report at bugs.python.org
Tue Jun 3 04:44:02 CEST 2014


akira added the comment:

> First, with the use of Overlapped IO on Windows, BlockingIOError should never come up, and we don't even handle that exception.

Is it correct that the way to distinguish between "would block" and EOF 
is Popen.poll()? Is it possible to detect it in _nonblocking() methods
 and raise BlockingIOError manually (or return None for read_..()) in "would block" case?

> But the majority of consumers of this API (and most APIs in general) will experience failure and could lose critical information before they realize, "Oh wait, I need to wrap all of these communication pieces in exception handlers."

It is an argument to catch *all* OSErrors internally that is not a good idea.

Popen.communicate() hides EPIPE in the current implementation therefore its behaviour 
shouldn't change. But subprocess' code allows Popen.stdin.write() to raise "broken pipe".
My questions are about _nonblocking() methods e.g., it is not obvious whether 
write_nonblocking() should mask EPIPE as EOF. If it does then It should be documented.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1191964>
_______________________________________


More information about the Python-bugs-list mailing list