Skip to content

[3.8] bpo-26510: Add versionchanged for required arg of add_subparsers (GH-16588) #16608

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

Merged
merged 1 commit into from
Oct 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Doc/library/argparse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1595,7 +1595,7 @@ Sub-commands
stored; by default ``None`` and no value is stored

* required_ - Whether or not a subcommand must be provided, by default
``False``.
``False`` (added in 3.7)

* help_ - help for sub-parser group in help output, by default ``None``

Expand Down Expand Up @@ -1751,6 +1751,9 @@ Sub-commands
>>> parser.parse_args(['2', 'frobble'])
Namespace(subparser_name='2', y='frobble')

.. versionchanged:: 3.7
New *required* keyword argument.


FileType objects
^^^^^^^^^^^^^^^^
Expand Down
4 changes: 4 additions & 0 deletions Doc/whatsnew/3.7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2401,6 +2401,10 @@ Changes in the Python API
instead of a :class:`bytes` instance.
(Contributed by Victor Stinner in :issue:`21071`.)

* :mod:`argparse` subparsers can now be made mandatory by passing ``required=True``
to :meth:`ArgumentParser.add_subparsers() <argparse.ArgumentParser.add_subparsers>`.
(Contributed by Anthony Sottile in :issue:`26510`.)

* :meth:`ast.literal_eval()` is now stricter. Addition and subtraction of
arbitrary numbers are no longer allowed.
(Contributed by Serhiy Storchaka in :issue:`31778`.)
Expand Down