python / python/cpython

subprocess.Popen: warnings.warn() calls missing stacklevel=2

Open
#148,402 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stdlib topic-multiprocessing type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Both warnings.warn() calls in subprocess.Popen.__init__ are missing stacklevel=2:

  1. POSIX path (line 915): Warning when pass_fds overrides close_fds
  2. 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
  • gh-148400
  • gh-148668

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in subprocess.py at the POSIX and Windows warnings.warn() calls identified at lines 915 and 1569, and review PR #148400 for existing work. The change is complete when both warnings point to the caller's Popen() invocation rather than an internal subprocess.py line.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
operating-systems
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.