Skip to content

Commit 9ad94f3

Browse files
committed
bpo-19764: Fixed the handle_list warning with close_fds=True
Also fixed the documentation for handle_list.
1 parent ad07b10 commit 9ad94f3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Doc/library/subprocess.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ on Windows.
809809
Supported attributes:
810810

811811
**handle_list**
812-
When *close_fds* is :const:`True`, supplies a list of
812+
When *close_fds* is :const:`False`, supplies a list of
813813
handles that will be inherited.
814814

815815
.. versionadded:: 3.7

Lib/subprocess.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -981,9 +981,9 @@ def _execute_child(self, args, executable, preexec_fn, close_fds,
981981
startupinfo.hStdError = errwrite
982982

983983
attribute_list = startupinfo.lpAttributeList
984-
have_handle_list = (attribute_list and
985-
"handle_list" in attribute_list and
986-
attribute_list["handle_list"])
984+
have_handle_list = bool(attribute_list and
985+
"handle_list" in attribute_list and
986+
attribute_list["handle_list"])
987987

988988
# If we were given an handle_list or need to create one
989989
if have_handle_list or (use_std_handles and close_fds):
@@ -997,7 +997,7 @@ def _execute_child(self, args, executable, preexec_fn, close_fds,
997997
handle_list[:] = self._filter_handle_list(handle_list)
998998

999999
if handle_list:
1000-
if have_handle_list and not close_fds:
1000+
if have_handle_list and close_fds:
10011001
warnings.warn("startupinfo.lpAttributeList['handle_list'] "
10021002
"overriding close_fds", RuntimeWarning)
10031003

0 commit comments

Comments
 (0)