classification
Title: Implementation of the PEP 433: Easier suppression of file descriptor inheritance
Type: enhancement Stage:
Components: Interpreter Core Versions: Python 3.4
process
Status: closed Resolution: rejected
Dependencies: Superseder: Implementation of the PEP 446: non-inheritable file descriptors
View: 18571
Assigned To: Nosy List: Arfrever, haypo
Priority: normal Keywords: patch

Created on 2013-01-25 22:01 by haypo, last changed 2013-08-28 19:56 by haypo. This issue is now closed.

Files
File name Uploaded Description Edit
bc88690df059.patch haypo, 2013-01-29 12:54 review
Repositories containing patches
http://hg.python.org/features/pep-433
Messages (10)
msg180630 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2013-01-25 22:01
I create this issue to review and track the implementation of the PEP 433: "Easier suppression of file descriptor inheritance"
http://www.python.org/dev/peps/pep-0433/
msg180636 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2013-01-26 01:00
Here is a patch of the latest revision.

configure and Python/importlib.h must be regenerated (are not part of the diff).
msg180637 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2013-01-26 01:51
I tested 9bdfa1a3ea8c.patch on Fedora 16 (Linux 3.6, glibc 2.14), Debian Etch (Linux 2.6.19), OpenBSD 5.2, OpenIndiana, FreeBSD 8.2, Windows 7.

I tested both cases (works/not supported) for O_CLOEXEC and SOCK_CLOEXEC. For the WSA_FLAG_NO_HANDLE_INHERIT flag, I only tested a Windows version not supporting it (Windows 7 SP1 is required).
msg180638 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2013-01-26 01:52
The select module may need more work.
msg180903 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2013-01-29 12:54
New patch:

 - sys.setdefaultcloexec() takes again an argument, so sys.setdefaultcloexec(False) is allowed
 - add cloexec parameter to select.devpoll(), select.kqueue() and select.epoll()
 - when a function accepts a file name and a file descriptor: the cloexec parameter is ignored if the argument is a file descriptor (it was already done for open(), but not for socket.socket on Windows)
 - revert enhancements using cloexec=True to simplify the patch: will be done in another issue
 - fix various bugs in error handling (close newly created file descriptors on error)
 - release the GIL when calling the os: os.urandom(), os.pipe(), os.dup(), etc.
msg180904 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2013-01-29 12:56
My TODO list is almost empty: the implementation is done. I just see possible enhancement on Windows: socket.socket() and os.dup() can use an atomic flag to set close-on-exec if native functions are used (WSASocket, DuplicateHandle) instead of the POSIX API. But it can be done later.
msg180907 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2013-01-29 13:10
"revert enhancements using cloexec=True to simplify the patch: will be done in another issue"

I just created the issue #17070 to track this task.
msg180908 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2013-01-29 13:16
> My TODO list is almost empty

Oh, I forgot one point: I stil don't know if the close-on-exec flag of
file descriptors of pass_fds argument of subprocess.Popen should be
set. If close-on-exec flag is set globally, it's not convinient to
have to clear the flag manually on each file descriptor.
msg180957 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2013-01-29 23:10
I tested bc88690df059.patch on Solaris 9: test_os failed on openpty(cloexec=True). It looks like setting close-on-exec on master_fd must be done after grantpt().
msg196411 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2013-08-28 19:56
The PEP 433 was rejected, replaced with the PEP 446.
History
Date User Action Args
2013-08-28 19:56:42hayposetstatus: open -> closed
superseder: Implementation of the PEP 446: non-inheritable file descriptors
resolution: rejected
messages: + msg196411
2013-07-27 15:21:43hayposetfiles: - ecc10f0afb76.diff
2013-07-27 15:20:37hayposetfiles: + ecc10f0afb76.diff
2013-04-09 22:15:51haypolinkissue16850 superseder
2013-01-29 23:10:50hayposetmessages: + msg180957
2013-01-29 13:26:50hayposetfiles: - 9bdfa1a3ea8c.patch
2013-01-29 13:16:17hayposetmessages: + msg180908
2013-01-29 13:10:26hayposetmessages: + msg180907
2013-01-29 12:56:35hayposetmessages: + msg180904
2013-01-29 12:54:36hayposetfiles: + bc88690df059.patch

messages: + msg180903
2013-01-26 03:03:30Arfreversetnosy: + Arfrever
2013-01-26 01:52:24hayposetmessages: + msg180638
2013-01-26 01:51:47hayposetmessages: + msg180637
2013-01-26 01:00:50hayposetfiles: + 9bdfa1a3ea8c.patch

messages: + msg180636
2013-01-26 00:26:13hayposetfiles: - 297b3529876a.diff
2013-01-25 22:02:40hayposetfiles: + 297b3529876a.diff
keywords: + patch
2013-01-25 22:01:25haypocreate