summaryrefslogtreecommitdiffstats
path: root/Lib/subprocess.py
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2012-11-11 09:37:02 (GMT)
committerGregory P. Smith <greg@krypto.org>2012-11-11 09:37:02 (GMT)
commit12489d98e692717a93694644dac4975d54106178 (patch)
treefd89ced1744ea9395e0d5d0cd432b3a3b8641f5b /Lib/subprocess.py
parent3aee2221229b9802dcc27b2709d5e97918b8ad46 (diff)
downloadcpython-12489d98e692717a93694644dac4975d54106178.zip
cpython-12489d98e692717a93694644dac4975d54106178.tar.gz
cpython-12489d98e692717a93694644dac4975d54106178.tar.bz2
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 fcc3e6e..a322829 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -1378,9 +1378,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)