summaryrefslogtreecommitdiff
path: root/Lib/subprocess.py
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2012-11-11 01:38:18 -0800
committerGregory P. Smith <greg@krypto.org>2012-11-11 01:38:18 -0800
commitc8ac03d936fd9fa7b48c0aaac01b66e8d8fcf766 (patch)
tree17694b3e6aa5de57be8c50335e735b5c51ae7ae9 /Lib/subprocess.py
parent6893732c353ed7cbd2492164aa2b7c64a9f1c840 (diff)
parent12489d98e692717a93694644dac4975d54106178 (diff)
downloadcpython-git-c8ac03d936fd9fa7b48c0aaac01b66e8d8fcf766.tar.gz
Fixes issue #16140: The subprocess module no longer double closes its
child subprocess.PIPE parent file descriptors on child error prior to exec(). This would lead to race conditions in multithreaded programs where another thread opened a file reusing the fd which was then closed out from beneath it by the errant second close.
Diffstat (limited to 'Lib/subprocess.py')
-rw-r--r--Lib/subprocess.py3
1 files changed, 0 insertions, 3 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index dad7b1670d..d3d90ca2ce 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -1419,9 +1419,6 @@ class Popen(object):
child_exception_type = getattr(
builtins, exception_name.decode('ascii'),
RuntimeError)
- for fd in (p2cwrite, c2pread, errread):
- if fd != -1:
- os.close(fd)
err_msg = err_msg.decode(errors="surrogatepass")
if issubclass(child_exception_type, OSError) and hex_errno:
errno_num = int(hex_errno, 16)