[Python-Dev] cpython (3.2): Fixes issue #8052: The posix subprocess module's close_fds behavior was

Gregory P. Smith greg at krypto.org
Sun Jan 22 00:36:26 CET 2012


On Sat, Jan 21, 2012 at 2:52 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> On Sat, 21 Jan 2012 23:39:41 +0100
> gregory.p.smith <python-checkins at python.org> wrote:
>> http://hg.python.org/cpython/rev/61aa484a3e54
>> changeset:   74563:61aa484a3e54
>> branch:      3.2
>> parent:      74561:d01fecadf3ea
>> user:        Gregory P. Smith <greg at krypto.org>
>> date:        Sat Jan 21 14:01:08 2012 -0800
>> summary:
>>   Fixes issue #8052: The posix subprocess module's close_fds behavior was
>> suboptimal by closing all possible file descriptors rather than just
>> the open ones in the child process before exec().
>
> For what it's worth, I'm not really confident with so much new low-level
> code in a bugfix release.
> IMHO it's more of a new feature, since it's a performance improvement.

No APIs change and it makes the subprocess module usable on systems
running with high file descriptor limits where it was painfully slow
to use in the past.

This was a regression in behavior introduced with 3.2's change to make
close_fds=True be the (quite sane) default so I do consider it a fix
rather than a performance improvement.

Obviously the final decision rests with the 3.2.3 release manager.

For anyone uncomfortable with the code itself: The equivalent of that
code has been in use in production at work continuously in
multithreaded processes across a massive number of machines running a
variety of versions of Linux for many years now.  And the non-Linux
code is effectively what the Java VM's Process module does.

-gps


More information about the Python-Dev mailing list