[Python-Dev] PEP 433: Add cloexec argument to functions creating file descriptors

Nick Coghlan ncoghlan at gmail.com
Mon Jan 14 13:15:49 CET 2013


On Mon, Jan 14, 2013 at 9:23 PM, Victor Stinner
<victor.stinner at gmail.com> wrote:
>>> XXX Should ``subprocess.Popen`` set the close-on-exec flag on file XXX
>>> XXX descriptors of the constructor the ``pass_fds`` argument?      XXX
>>
>> What?
>> Setting them cloexec would prevent them from being inherited in the
>> child process!
>
> Oops, it's just the opposite: pass_fds should (must?) *clear* the flag
> :-) (I'm not sure of what should be done here.)

Turning off a security feature implicitly isn't a good idea. If
someone passes such a descriptor, their child application will fail
noisily - it's then up to the developer to decide if they passed the
wrong file descriptor, or simply need to ensure the one they passed
remains open in the child process.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list