Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 6, 2023

Conversation

arhadthedev
Copy link
Member

@arhadthedev arhadthedev commented Feb 10, 2023

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

@arhadthedev
Copy link
Member Author

Ping?

@arhadthedev arhadthedev changed the title gh-101640: Argparse without stdio gh-101640: Make argparse working in pythonw by dropping stderr writes there Apr 9, 2023
@arhadthedev
Copy link
Member Author

ping

@arhadthedev arhadthedev added the needs backport to 3.11 only security fixes label Apr 23, 2023
Copy link
Member

@terryjreedy terryjreedy left a comment

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.

@bedevere-bot
Copy link

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.

@arhadthedev
Copy link
Member Author

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 arhadthedev closed this May 6, 2023
@arhadthedev arhadthedev reopened this May 6, 2023
@arhadthedev
Copy link
Member Author

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

Thanks for making the requested changes!

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

@bedevere-bot bedevere-bot requested a review from terryjreedy May 6, 2023 19:17
@miss-islington
Copy link
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

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

@bedevere-bot bedevere-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 <[email protected]>
Co-authored-by: Terry Jan Reedy <[email protected]>
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 <[email protected]>
Co-authored-by: Terry Jan Reedy <[email protected]>
@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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir topic-IO
Projects
Status: Doc issues
Development

Successfully merging this pull request may close these issues.

4 participants