argparse: Remove unused name variable when handling ArgumentTypeError (#96549)

This removes the unused `name` variable in the block where `ArgumentTypeError` is handled.

`ArgumentTypeError` errors are handled by showing just the string of the exception; unlike `ValueError`, the name (`__name__`) of the function is not included in the error message.

Fixes #96548
This commit is contained in:
Jonathon Reinhart 2022-09-05 17:32:23 -04:00 committed by GitHub
parent c4999f261f
commit 30878a7735
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 1 deletions

View File

@ -2523,7 +2523,6 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
# ArgumentTypeErrors indicate errors
except ArgumentTypeError as err:
name = getattr(action.type, '__name__', repr(action.type))
msg = str(err)
raise ArgumentError(action, msg)