Both warnings.warn() calls in subprocess.Popen.__init__ are missing stacklevel=2:
- POSIX path (line 915): Warning when
pass_fds overrides close_fds
- Windows path (line 1569): Warning when
startupinfo.lpAttributeList['handle_list'] overrides close_fds
Without stacklevel=2, the warning points to an internal line inside subprocess.py rather than the caller's Popen() invocation, making it harder for users to locate the source.
PR: #148400
Linked PRs
Both
warnings.warn()calls insubprocess.Popen.__init__are missingstacklevel=2:pass_fdsoverridesclose_fdsstartupinfo.lpAttributeList['handle_list']overridesclose_fdsWithout
stacklevel=2, the warning points to an internal line insidesubprocess.pyrather than the caller'sPopen()invocation, making it harder for users to locate the source.PR: #148400
Linked PRs