[argparse] Allow string actions in add_subparsers - #16318
Conversation
This comment has been minimized.
This comment has been minimized.
|
Please remove the tests. In typeshed, we only add regression tests for functions and classes which are known to have caused complex problems in the past, or where stubs are difficult to get right. 100% test coverage for typeshed is neither necessary nor desirable, as it would lead to code duplication. See |
|
Thanks for the guidance. I removed the regression test in d368f24. The focused mypy and Pyright checks for stdlib/argparse.pyi pass, as do the pre-commit hooks for the changed stub. |
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
donbarbos
left a comment
There was a problem hiding this comment.
Thanks! And just for future reference, you don't need to mention that the tests are passing, as the CI status already tells us that.
Fixes #16309
The runtime accepts registered action names as strings in ArgumentParser.add_subparsers, just as add_argument does. This widens both overloads to accept str | type[Action] and adds a regression test using the built-in parsers registration.
Tests: