Skip to content

gh-101640: Make argparse working in pythonw by dropping stderr writes there - #101802

Merged
terryjreedy merged 5 commits into
python:mainfrom
arhadthedev:argparse-without-stdio
May 6, 2023
Merged

gh-101640: Make argparse working in pythonw by dropping stderr writes there#101802
terryjreedy merged 5 commits into
python:mainfrom
arhadthedev:argparse-without-stdio

Conversation

@arhadthedev

@arhadthedevarhadthedev commented Feb 10, 2023

Copy link
Copy Markdown
Member

A note on freshly added tests:

  • StdStreamTest.test_skip_invalid_stderr() is confirmed to be failing before the patch
  • StdStreamTest.test_skip_invalid_stdout() is added for symmetry; its tested behavior already worked correctly

@arhadthedevarhadthedev added stdlib Standard Library Python modules in the Lib/ directory topic-IO labels Feb 10, 2023
@arhadthedev

Copy link
Copy Markdown
MemberAuthor

Ping?

@arhadthedevarhadthedev changed the title gh-101640: Argparse without stdiogh-101640: Make argparse working in pythonw by dropping stderr writes thereApr 9, 2023
@arhadthedev

Copy link
Copy Markdown
MemberAuthor

ping

@arhadthedevarhadthedev added the needs backport to 3.11 only security fixes label Apr 23, 2023

@terryjreedyterryjreedy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure who you are pinging, but... tests look OK to me. I just suggest catching any write error.

Comment threadLib/argparse.py Outdated
Comment threadMisc/NEWS.d/next/Library/2023-02-09-22-24-34.gh-issue-101640.oFuEpB.rst Outdated
@bedevere-bot

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
@arhadthedev

Copy link
Copy Markdown
MemberAuthor

Retriggering the build to restart the failed docs/readthedocs.org:cpython-previews:

Running Sphinx v4.5.0
loading translations [en]... done
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/cpython-previews/envs/101802/lib/python3.7/site-packages/sphinx/registry.py", line 425, in load_extension
mod = import_module(extname)
File "/home/docs/checkouts/readthedocs.org/user_builds/cpython-previews/envs/101802/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/docs/checkouts/readthedocs.org/user_builds/cpython-previews/envs/101802/lib/python3.7/site-packages/sphinx/builders/linkcheck.py", line 20, in <module>
from requests import Response
File "/home/docs/checkouts/readthedocs.org/user_builds/cpython-previews/envs/101802/lib/python3.7/site-packages/requests/__init__.py", line 43, in <module>
import urllib3
File "/home/docs/checkouts/readthedocs.org/user_builds/cpython-previews/envs/101802/lib/python3.7/site-packages/urllib3/__init__.py", line 39, in <module>
"urllib3 v2.0 only supports OpenSSL 1.1.1+, currently "
ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with OpenSSL 1.0.2n 7 Dec 2017. See: https://github.com/urllib3/urllib3/issues/2168

@arhadthedev

Copy link
Copy Markdown
MemberAuthor

The docs deploy continues to fail. However, this PR doesn't change documentation so I believe it can be ignored for now.

For Bedevere: I have made the requested changes; please review again.

@bedevere-bot

Copy link
Copy Markdown

Thanks for making the requested changes!

@terryjreedy: please review the changes made to this pull request.

@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @arhadthedev for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@bedevere-bot

Copy link
Copy Markdown

GH-104250 is a backport of this pull request to the 3.11 branch.

@bedevere-botbedevere-bot removed the needs backport to 3.11 only security fixes label May 6, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 6, 2023
…ythonGH-101802)
* In particular, don't exit when trying to print to stderr = None.
* Add tests
(cherry picked from commit 42f54d1)
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
terryjreedy added a commit that referenced this pull request May 6, 2023
…H-101802) (#104250)
gh-101640: Make argparse _print_message catch any write error (GH-101802)
* In particular, don't exit when trying to print to stderr = None.
* Add tests
(cherry picked from commit 42f54d1)
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
@arhadthedev
arhadthedev deleted the argparse-without-stdio branch May 7, 2023 06:13
jbower-fb pushed a commit to jbower-fb/cpython that referenced this pull request May 8, 2023
…ython#101802)
* In particular, don't exit when trying to print to stderr = None.
* Add tests
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stdlibStandard Library Python modules in the Lib/ directorytopic-IO

Projects

Status: Doc issues

Development

Successfully merging this pull request may close these issues.

4 participants

@arhadthedev@bedevere-bot@miss-islington@terryjreedy