Content-Length: 283032 | pFad | https://github.com/python/cpython/issues/101640

3A argparse: Check if stderr is defined before writing to it · Issue #101640 · python/cpython · GitHub
Skip to content

argparse: Check if stderr is defined before writing to it #101640

@simaoafonso-pwt

Description

@simaoafonso-pwt

Bug report

argparse tries to write to stderr inconditionally, even when it's None. This is only a problem on Windows. Here:

https://github.com/python/cpython/blob/3.11/Lib/argparse.py#L2596-L2600

I detected this when using PyInstaller to create a binary on Windows using --noconsole, which triggers using pythonw.exe. In this case, sys.stderr is None.

This is similar to #89057

Your environment

  • Any version of Python on Windows, up to 3.11

Linked PRs

Metadata

Metadata

Assignees

Labels

OS-windowspendingThe issue will be closed if no feedback is providedstdlibStandard Library Python modules in the Lib/ directorytopic-IOtype-bugAn unexpected behavior, bug, or error

Projects

Status

Doc issues

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions









    ApplySandwichStrip

    pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


    --- a PPN by Garber Painting Akron. With Image Size Reduction included!

    Fetched URL: https://github.com/python/cpython/issues/101640

    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy