Skip to content

The argparse Action class omits "required" for the "names" list #91832

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
rhettinger opened this issue Apr 22, 2022 · 2 comments
Closed

The argparse Action class omits "required" for the "names" list #91832

rhettinger opened this issue Apr 22, 2022 · 2 comments
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes easy stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@rhettinger
Copy link
Contributor

This has the user visible effect of the required attribute not displaying in the repr:

>>> a = ArgumentParser().add_argument('-a', required=True)
>>> a.required
True
>>> a
_StoreAction(option_strings=['-a'], dest='a', nargs=None, const=None, default=None, type=None, choices=None, help=None, metavar=None)
@rhettinger rhettinger added type-bug An unexpected behavior, bug, or error easy labels Apr 22, 2022
@AlexWaygood AlexWaygood added the stdlib Python modules in the Lib dir label Apr 22, 2022
@fatihkabakk
Copy link
Contributor

fatihkabakk commented Apr 22, 2022

Found the solution, working on the commit.

fatihkabakk added a commit to fatihkabakk/cpython that referenced this issue Apr 22, 2022
fatihkabakk added a commit to fatihkabakk/cpython that referenced this issue Apr 22, 2022
@merwok merwok added 3.11 only security fixes 3.10 only security fixes 3.9 only security fixes labels Apr 28, 2022
miss-islington pushed a commit that referenced this issue Apr 28, 2022
# Adding 'required' to names in Lib.argparse.Action

gh-91832: 
Added 'required' to the list `names` in `Lib.argparse.Action`. 
Changed constant strings that test the Action object.

Automerge-Triggered-By: GH:merwok
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Apr 28, 2022
…-91841)

GH- Adding 'required' to names in Lib.argparse.Action

pythongh-91832:
Added 'required' to the list `names` in `Lib.argparse.Action`.
Changed constant strings that test the Action object.

Automerge-Triggered-By: GH:merwok
(cherry picked from commit 4ed3900)

Co-authored-by: Abhigyan Bose <abhigyandeepbose@gmail.com>
miss-islington added a commit that referenced this issue Apr 28, 2022
GH- Adding 'required' to names in Lib.argparse.Action

gh-91832:
Added 'required' to the list `names` in `Lib.argparse.Action`.
Changed constant strings that test the Action object.

Automerge-Triggered-By: GH:merwok
(cherry picked from commit 4ed3900)

Co-authored-by: Abhigyan Bose <abhigyandeepbose@gmail.com>
miss-islington added a commit that referenced this issue Apr 28, 2022
GH- Adding 'required' to names in Lib.argparse.Action

gh-91832:
Added 'required' to the list `names` in `Lib.argparse.Action`.
Changed constant strings that test the Action object.

Automerge-Triggered-By: GH:merwok
(cherry picked from commit 4ed3900)

Co-authored-by: Abhigyan Bose <abhigyandeepbose@gmail.com>
@merwok
Copy link
Member

merwok commented Apr 28, 2022

Fixed, thanks to you both for the pull requests!

@merwok merwok closed this as completed Apr 28, 2022
hello-adam pushed a commit to hello-adam/cpython that referenced this issue Jun 2, 2022
…-91841)

GH- Adding 'required' to names in Lib.argparse.Action

pythongh-91832:
Added 'required' to the list `names` in `Lib.argparse.Action`.
Changed constant strings that test the Action object.

Automerge-Triggered-By: GH:merwok
(cherry picked from commit 4ed3900)

Co-authored-by: Abhigyan Bose <abhigyandeepbose@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes easy stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants