summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2018-09-11 00:46:22 (GMT)
committerGitHub <noreply@github.com>2018-09-11 00:46:22 (GMT)
commitce34410b8b67f49d8275c05d51b3ead50cf97f48 (patch)
tree08e99370a122056aa4101d670e505217961c4058 /Misc
parent880d42a3b247306f67837aa95e23f7c3471a30a3 (diff)
downloadcpython-ce34410b8b67f49d8275c05d51b3ead50cf97f48.zip
cpython-ce34410b8b67f49d8275c05d51b3ead50cf97f48.tar.gz
cpython-ce34410b8b67f49d8275c05d51b3ead50cf97f48.tar.bz2
bpo-32270: Don't close stdin/out/err in pass_fds (GH-6242)
When subprocess.Popen() stdin= stdout= or stderr= handles are specified and appear in pass_fds=, don't close the original fds after dup'ing them. This implementation and unittest primarily came from @izbyshev (see the PR) See also https://github.com/izbyshev/cpython/commit/b89b52f28490b69142d5c061604b3a3989cec66c This also removes the old manual p2cread, c2pwrite, and errwrite closing logic as inheritable flags and _close_open_fds takes care of that properly today without special treatment. This code is within child_exec() where it is the only thread so there is no race condition between the dup and _Py_set_inheritable_async_safe call.
Diffstat (limited to 'Misc')
-rw-r--r--Misc/NEWS.d/next/Library/2018-09-10-14-15-53.bpo-32270.wSJjuD.rst2
1 files changed, 2 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2018-09-10-14-15-53.bpo-32270.wSJjuD.rst b/Misc/NEWS.d/next/Library/2018-09-10-14-15-53.bpo-32270.wSJjuD.rst
new file mode 100644
index 0000000..83f6862
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2018-09-10-14-15-53.bpo-32270.wSJjuD.rst
@@ -0,0 +1,2 @@
+The subprocess module no longer mistakenly closes redirected fds even when
+they were in pass_fds when outside of the default {0, 1, 2} set.