[Python-Dev] PEP 446 (make FD non inheritable) ready for a final review

Victor Stinner victor.stinner at gmail.com
Thu Aug 22 23:32:11 CEST 2013


I know that I wrote it more than once, but I consider that my PEP 446
is now ready for a final review:


The implementation is also working, complete and ready for a review.


I run regulary the test suite on my virtual machines: Windows 7 SP1,
Linux 3.2, FreeBSD 9 and OpenIndiana (close to Solaris 11), but also
sometimes on OpenBSD 5.2. I don't expect major bugs, but you may find
minor issues, especially on old operating systems. I don't have access
to older systems.


I collected the list of all threads related to the inheritance of file
descriptors on python-dev since january 2013. I counted no more than
239 messages! Thank you all developers who contributed to these
discussions and so helped me to write the PEP 433 and the PEP 446,
especially Charles-François Natali and Richard Oudkerk!

I read again all these messages, and I cannot "go backward" to the PEP
433. There are too many good reasons against adding a global variable
(sys.getdefaultcloexec()), and adding a new inheritable parameter
without changing the inheritance to non-inheritable does not solve
issues listed in the Rationale of the PEP 446.

At the beginning of the discussions, most developers already agreed
that making file descriptors non-inheritable by default is the best
choice. It took me some months to really understand all the
consequences of changing the inheritance. I had also many technical
issues because each operating system handles the inheritance of file
descriptors differently, especially Windows vs UNIX. For atomic flags,
there are differences even between minor versions of operating
systems. For example, the O_CLOEXEC flag is only supported since Linux
2.6.23. We spend a lot of time to discuss each intermediate solution,
but the conclusion is that no compromise can be found on an
intermediate solution, only a radical change can solve the problem.

[Python-Dev] Add "e" (close and exec) mode to open() (13 messages)
Tue Jan 8 2013

[Python-Dev] Set close-on-exec flag by default in SocketServer (31)
Wed Jan 9 2013

[Python-Dev] PEP 433: Add cloexec argument to functions creating file
descriptors (27)
Sun Jan 13 2013

[Python-Dev] Implementation of the PEP 433 (2)
Fri Jan 25 2013

[Python-Dev] PEP 433: Choose the default value of the new cloexec parameter (37)
Fri Jan 25 2013

[Python-Dev] PEP 433: second try (5)
Tue Jan 29 2013

[Python-Dev] Release or not release the GIL (11)
Fri Feb 1 2013

[Python-Dev] Status of the PEP 433? (2)
Thu Feb 14 2013

[Python-Dev] PEP 446: Add new parameters to configure the inherance of
files and for non-blocking sockets (24)
Thu Jul 4 2013

[Python-Dev] Inherance of file descriptor and handles on Windows (PEP 446) (41)
Wed Jul 24 2013

[Python-Dev] PEP 446: Open issues/questions (29)
Sun Jul 28 2013

[Python-Dev] (New) PEP 446: Make newly created file descriptors
non-inheritable (8)
Tue Aug 6 2013

[Python-Dev] PEP 446: issue with sockets (9)
Wed Aug 21 2013


More information about the Python-Dev mailing list