homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dmalcolm
Recipients dmalcolm
Date 2011年01月20日.20:23:29
SpamBayes Score 4.6884048e-09
Marked as misclassified No
Message-id <1295555014.31.0.879687826689.issue10963@psf.upfronthosting.co.za>
In-reply-to
Content
If we start a short-lived process which finishes before we begin communicating with it (e.g. by crashing), we can receive a SIGPIPE due to the receiving process no longer existing. This becomes an EPIPE, which becomes an:
 OSError: [Errno 32] Broken pipe
Arguably this is a bug; if the subprocess could crash, the user currently has to check for it by both monitoring the returncode _and_ catching OSError (then examining for this specific errno), which seems ugly to me.
I'm attaching a patch for subprocess which handles this case, masking the OSError within the Popen implementation, so that you have to test for it within the returncode, in one place, rather than wrap every call with a try/except.
It could be argued that this is incorrect, as it masks under-reads of stdin by the subprocess. However I believe a sanely-written subprocess ought to indicate success/failure back with its return code.
This was originally filed downstream within the Red Hat bugzilla instance as:
 https://bugzilla.redhat.com/show_bug.cgi?id=667431
The handler part of the patch is based on a patch attached there by Federico Simoncelli; I don't know if he has signed a PSF contributor agreement, however the size of the patch is sufficiently small that I suspect it's not copyrightable, and I've somewhat rewritten it since; I wrote the unit test.
History
Date User Action Args
2011年01月20日 20:23:34dmalcolmsetrecipients: + dmalcolm
2011年01月20日 20:23:34dmalcolmsetmessageid: <1295555014.31.0.879687826689.issue10963@psf.upfronthosting.co.za>
2011年01月20日 20:23:29dmalcolmlinkissue10963 messages
2011年01月20日 20:23:29dmalcolmcreate

AltStyle によって変換されたページ (->オリジナル) /