Skip to content

Replace the old getopt with argparse in pdb CLI #109164

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

Closed
gaogaotiantian opened this issue Sep 8, 2023 · 3 comments
Closed

Replace the old getopt with argparse in pdb CLI #109164

gaogaotiantian opened this issue Sep 8, 2023 · 3 comments
Labels
type-feature A feature request or enhancement

Comments

@gaogaotiantian
Copy link
Member

gaogaotiantian commented Sep 8, 2023

Feature or enhancement

Proposal:

pdb is using getopt for argument parsing. getopt is pretty old and not well maintained. Some issue in #108791 could be avoided with the modern argparse module. We should replace getopt with argparse when it's easy to do so. This might ease the load in the future when more arguments are added to the CLI.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

@gaogaotiantian gaogaotiantian added the type-feature A feature request or enhancement label Sep 8, 2023
vstinner added a commit that referenced this issue Sep 22, 2023
Co-authored-by: Adam Turner <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
csm10495 pushed a commit to csm10495/cpython that referenced this issue Sep 28, 2023
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
@serhiy-storchaka
Copy link
Member

Actually, getopt is stable and argparse has many bugs (some of them are design flaws).

@ericvsmith
Copy link
Member

I agree that argparse has many problems and isn't the best choice. And this is coming from someone who was pushing to get it in the stdlib.

@gaogaotiantian
Copy link
Member Author

getopt is soft deprecated since 3.13. It doesn't mean that we can't use it, it's just we should try to use actively maintained stdlib. Also the CLI for pdb is not that complicated. I agree there are issues with argparse, but there are issues with getopt as well (see the linked issue). I believe CPython will always have a CLI parser in its stdlib. It's argparse now but maybe in the future there will be a better designed alternative, we can switch to that then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

4 participants