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 jcea
Recipients Mark.Gius, gregory.p.smith, jcea, neologix
Date 2012-10-26.00:16:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1351210569.78.0.479942699021.issue16327@psf.upfronthosting.co.za>
In-reply-to
Content
I would catch ALL exceptions, not only "OSError".

An easy way to test this would be to test a subclass of Popen with "_execute_child()" method overrided for always raising an exception.

On Unix the test could just open six fds, close them taking note of the values, call this code forcing an exception, catch it, open six new fds and verify that the numbers are the same. So we verify that neither of the six fds created "inside" are leaked.

What should we do for Windows?


Maybe the easier and more portable approach for exception cleanup would be to do "_execute_child()" AFTER the "fdopen()" dance, so we can just do "close()" if any exception is raised.

Also, the cleanup MUST be done ONLY if the fds were created inside the function (PIPE), not if the fd came from the caller.
History
Date User Action Args
2012-10-26 00:16:10jceasetrecipients: + jcea, gregory.p.smith, neologix, Mark.Gius
2012-10-26 00:16:09jceasetmessageid: <1351210569.78.0.479942699021.issue16327@psf.upfronthosting.co.za>
2012-10-26 00:16:09jcealinkissue16327 messages
2012-10-26 00:16:07jceacreate