[issue22240] argparse support for "python -m module" in help

Nils Kattenbeck report at bugs.python.org
Sun Aug 8 18:41:00 EDT 2021


Nils Kattenbeck <nilskemail at gmail.com> added the comment:

I implemented the logic and adjusted the existing tests to have a fixed program name. I also fixed the build error by changing how zip files are detected. Based on you comment Nick you however even had a different idea. Currently I check if __spec__.__loader__ is a zip loader but if I understood correct you suggest the check if __spec__.__location__ is a proper subdir of sys.argv[0]?

https://github.com/septatrix/cpython/compare/main...septatrix:enhance/argparse-prog-name.

When I have some more time I will check whether mocking works and otherwise checkout test.support.script_helper or making the function accept spec/argv0

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue22240>
_______________________________________


More information about the Python-bugs-list mailing list