diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-03-30 00:18:31 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-03-30 00:18:31 (GMT) |
commit | 160e819a1d0a01fe79b66bf398c925c0dac0ded1 (patch) | |
tree | 7980ede06448a0a978052440d27eb2dbbd8e124c /Modules/_posixsubprocess.c | |
parent | e4a994d6171f47ee9ba68ae1484d940349d62564 (diff) | |
download | cpython-160e819a1d0a01fe79b66bf398c925c0dac0ded1.zip cpython-160e819a1d0a01fe79b66bf398c925c0dac0ded1.tar.gz cpython-160e819a1d0a01fe79b66bf398c925c0dac0ded1.tar.bz2 |
Issue #23694: Fix usage of _Py_open() in the _posixsubprocess module
Don't call _Py_open() from _close_open_fds_safe() because it is call just after
fork(). It's not good to play with locks (the GIL) between fork() and exec().
Use instead _Py_open_noraise() which doesn't touch to the GIL.
Diffstat (limited to 'Modules/_posixsubprocess.c')
-rw-r--r-- | Modules/_posixsubprocess.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c index a33df21..0b385a1 100644 --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -254,10 +254,9 @@ _close_open_fds_safe(int start_fd, PyObject* py_fds_to_keep) { int fd_dir_fd; - fd_dir_fd = _Py_open(FD_DIR, O_RDONLY); + fd_dir_fd = _Py_open_noraise(FD_DIR, O_RDONLY); if (fd_dir_fd == -1) { /* No way to get a list of open fds. */ - PyErr_Clear(); _close_fds_by_brute_force(start_fd, py_fds_to_keep); return; } else { |