summaryrefslogtreecommitdiffstats
path: root/Doc/whatsnew
diff options
context:
space:
mode:
authorSegev Finer <segev208@gmail.com>2017-12-18 09:28:19 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2017-12-18 09:28:19 (GMT)
commitb2a6083eb0384f38839d3f1ed32262a3852026fa (patch)
treed95a4dd911ebc05549fe54dee0b76c67fe5c727a /Doc/whatsnew
parent87010e85cb37192d63b1a30e5fabba307ad5a3f5 (diff)
downloadcpython-b2a6083eb0384f38839d3f1ed32262a3852026fa.zip
cpython-b2a6083eb0384f38839d3f1ed32262a3852026fa.tar.gz
cpython-b2a6083eb0384f38839d3f1ed32262a3852026fa.tar.bz2
bpo-19764: Implemented support for subprocess.Popen(close_fds=True) on Windows (#1218)
Even though Python marks any handles it opens as non-inheritable there is still a race when using `subprocess.Popen` since creating a process with redirected stdio requires temporarily creating inheritable handles. By implementing support for `subprocess.Popen(close_fds=True)` we fix this race. In order to implement this we use PROC_THREAD_ATTRIBUTE_HANDLE_LIST which is available since Windows Vista. Which allows to pass an explicit list of handles to inherit when creating a process. This commit also adds `STARTUPINFO.lpAttributeList["handle_list"]` which can be used to control PROC_THREAD_ATTRIBUTE_HANDLE_LIST directly.
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r--Doc/whatsnew/3.7.rst19
1 files changed, 19 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst
index 3574b53..82f7cc0 100644
--- a/Doc/whatsnew/3.7.rst
+++ b/Doc/whatsnew/3.7.rst
@@ -437,6 +437,17 @@ string
expression pattern for braced placeholders and non-braced placeholders
separately. (Contributed by Barry Warsaw in :issue:`1198569`.)
+subprocess
+----------
+
+On Windows the default for *close_fds* was changed from :const:`False` to
+:const:`True` when redirecting the standard handles. It's now possible to set
+*close_fds* to :const:`True` when redirecting the standard handles. See
+:class:`subprocess.Popen`.
+
+This means that *close_fds* now defaults to :const:`True` on all supported
+platforms.
+
sys
---
@@ -883,6 +894,14 @@ Changes in the Python API
.. _Unicode Technical Standard #18: https://unicode.org/reports/tr18/
+* On Windows the default for the *close_fds* argument of
+ :class:`subprocess.Popen` was changed from :const:`False` to :const:`True`
+ when redirecting the standard handles. If you previously depended on handles
+ being inherited when using :class:`subprocess.Popen` with standard io
+ redirection, you will have to pass ``close_fds=False`` to preserve the
+ previous behaviour, or use
+ :attr:`STARTUPINFO.lpAttributeList <subprocess.STARTUPINFO.lpAttributeList>`.
+
Changes in the C API
--------------------