Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Lib/subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ def __init__(self, args, bufsize=-1, executable=None,
else:
# POSIX
if pass_fds and not close_fds:
warnings.warn("pass_fds overriding close_fds.", RuntimeWarning)
warnings.warn("pass_fds overriding close_fds.", RuntimeWarning, stacklevel=2)
close_fds = True
if startupinfo is not None:
raise ValueError("startupinfo is only supported on Windows "
Expand Down Expand Up @@ -1567,7 +1567,8 @@ def _execute_child(self, args, executable, preexec_fn, close_fds,
if handle_list:
if not close_fds:
warnings.warn("startupinfo.lpAttributeList['handle_list'] "
"overriding close_fds", RuntimeWarning)
"overriding close_fds", RuntimeWarning,
stacklevel=2)

# When using the handle_list we always request to inherit
# handles but the only handles that will be inherited are
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Add missing ``stacklevel=2`` to two :func:`warnings.warn` calls in
:class:`subprocess.Popen` so that warnings correctly point to the caller's
code instead of ``subprocess.py`` internals.
Loading