Skip to content

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

@stef41

Description

@stef41

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-multiprocessingtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions