8000 Fix exceptions in argparse · Issue #126068 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

Fix exceptions in argparse #126068

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
serhiy-storchaka opened this issue Oct 28, 2024 · 1 comment
Closed

Fix exceptions in argparse #126068

serhiy-storchaka opened this issue Oct 28, 2024 · 1 comment
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member
serhiy-storchaka commented Oct 28, 2024

Bug report

There are several issues with exceptions in the argparse module:

  • Only error messages for ArgumentError and ArgumentTypeError should be translated. These exceptions are the part of the user interface of the program that uses argparse. Other exceptions indicate logical errors in the program and are purposed for the programmer.
  • ArgumentError should only be used for command line errors, not for logical errors in the program.

Linked PRs

@serhiy-storchaka serhiy-storchaka added the type-bug An unexpected behavior, bug, or error label Oct 28, 2024
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Oct 28, 2024
* Only error messages for ArgumentError and ArgumentTypeError are now
  translated.
* ArgumentError is now only used for command line errors, not for logical
  errors in the program.
@picnixz picnixz added the stdlib Python modules in the Lib dir label Oct 28, 2024
serhiy-storchaka added a commit that referenced this issue Oct 30, 2024
* Only error messages for ArgumentError and ArgumentTypeError are now
  translated.
* ArgumentError is now only used for command line errors, not for logical
  errors in the program.
* TypeError is now raised instead of ValueError for some logical errors.
@serhiy-storchaka
Copy link
Member Author

Even if some of this looks like bugs, I decided to not backport the change, because there is a small chance of user code depending on this. The benefit of making all right is not large, most users will not notice the change.

@github-project-automation github-project-automation bot moved this to Doc issues in Argparse issues Oct 30, 2024
picnixz pushed a commit to picnixz/cpython that referenced this issue Dec 8, 2024
* Only error messages for ArgumentError and ArgumentTypeError are now
  translated.
* ArgumentError is now only used for command line errors, not for logical
  errors in the program.
* TypeError is now raised instead of ValueError for some logical errors.
ebonnal pushed a commit to ebonnal/cpython that referenced this issue Jan 12, 2025
* Only error messages for ArgumentError and ArgumentTypeError are now
  translated.
* ArgumentError is now only used for command line errors, not for logical
  errors in the program.
* TypeError is now raised instead of ValueError for some logical errors.
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 type-bug An unexpected behavior, bug, or error
Projects
Status: Doc issues
Development

No branches or pull requests

2 participants
0