Skip to content

Commit c7169cf

Browse files
Merge branch 'main' into refactor-tailcall-yml
2 parents 1391a10 + 6665115 commit c7169cf

File tree

7 files changed

+52
-33
lines changed

7 files changed

+52
-33
lines changed

Doc/library/argparse.rst

Lines changed: 42 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,7 +1771,7 @@ Subcommands
17711771
>>> parser.parse_args(['--foo', 'b', '--baz', 'Z'])
17721772
Namespace(baz='Z', foo=True)
17731773

1774-
Note that the object returned by :meth:`parse_args` will only contain
1774+
Note that the object returned by :meth:`~ArgumentParser.parse_args` will only contain
17751775
attributes for the main parser and the subparser that was selected by the
17761776
command line (and not any other subparsers). So in the example above, when
17771777
the ``a`` command is specified, only the ``foo`` and ``bar`` attributes are
@@ -1814,7 +1814,7 @@ Subcommands
18141814
-h, --help show this help message and exit
18151815
--baz {X,Y,Z} baz help
18161816

1817-
The :meth:`add_subparsers` method also supports ``title`` and ``description``
1817+
The :meth:`~ArgumentParser.add_subparsers` method also supports ``title`` and ``description``
18181818
keyword arguments. When either is present, the subparser's commands will
18191819
appear in their own group in the help output. For example::
18201820

@@ -1835,34 +1835,8 @@ Subcommands
18351835

18361836
{foo,bar} additional help
18371837

1838-
Furthermore, :meth:`~_SubParsersAction.add_parser` supports an additional
1839-
*aliases* argument,
1840-
which allows multiple strings to refer to the same subparser. This example,
1841-
like ``svn``, aliases ``co`` as a shorthand for ``checkout``::
1842-
1843-
>>> parser = argparse.ArgumentParser()
1844-
>>> subparsers = parser.add_subparsers()
1845-
>>> checkout = subparsers.add_parser('checkout', aliases=['co'])
1846-
>>> checkout.add_argument('foo')
1847-
>>> parser.parse_args(['co', 'bar'])
1848-
Namespace(foo='bar')
1849-
1850-
:meth:`~_SubParsersAction.add_parser` supports also an additional
1851-
*deprecated* argument, which allows to deprecate the subparser.
1852-
1853-
>>> import argparse
1854-
>>> parser = argparse.ArgumentParser(prog='chicken.py')
1855-
>>> subparsers = parser.add_subparsers()
1856-
>>> run = subparsers.add_parser('run')
1857-
>>> fly = subparsers.add_parser('fly', deprecated=True)
1858-
>>> parser.parse_args(['fly']) # doctest: +SKIP
1859-
chicken.py: warning: command 'fly' is deprecated
1860-
Namespace()
1861-
1862-
.. versionadded:: 3.13
1863-
18641838
One particularly effective way of handling subcommands is to combine the use
1865-
of the :meth:`add_subparsers` method with calls to :meth:`set_defaults` so
1839+
of the :meth:`~ArgumentParser.add_subparsers` method with calls to :meth:`~ArgumentParser.set_defaults` so
18661840
that each subparser knows which Python function it should execute. For
18671841
example::
18681842

@@ -1898,12 +1872,12 @@ Subcommands
18981872
>>> args.func(args)
18991873
((XYZYX))
19001874

1901-
This way, you can let :meth:`parse_args` do the job of calling the
1875+
This way, you can let :meth:`~ArgumentParser.parse_args` do the job of calling the
19021876
appropriate function after argument parsing is complete. Associating
19031877
functions with actions like this is typically the easiest way to handle the
19041878
different actions for each of your subparsers. However, if it is necessary
19051879
to check the name of the subparser that was invoked, the ``dest`` keyword
1906-
argument to the :meth:`add_subparsers` call will work::
1880+
argument to the :meth:`~ArgumentParser.add_subparsers` call will work::
19071881

19081882
>>> parser = argparse.ArgumentParser()
19091883
>>> subparsers = parser.add_subparsers(dest='subparser_name')
@@ -1922,6 +1896,43 @@ Subcommands
19221896
the main parser.
19231897

19241898

1899+
.. method:: _SubParsersAction.add_parser(name, *, help=None, aliases=None, \
1900+
deprecated=False, **kwargs)
1901+
1902+
Create and return a new :class:`ArgumentParser` object for the
1903+
subcommand *name*.
1904+
1905+
The *name* argument is the name of the sub-command.
1906+
1907+
The *help* argument provides a short description for this sub-command.
1908+
1909+
The *aliases* argument allows providing alternative names for this
1910+
sub-command. For example::
1911+
1912+
>>> parser = argparse.ArgumentParser()
1913+
>>> subparsers = parser.add_subparsers()
1914+
>>> checkout = subparsers.add_parser('checkout', aliases=['co'])
1915+
>>> checkout.add_argument('foo')
1916+
>>> parser.parse_args(['co', 'bar'])
1917+
Namespace(foo='bar')
1918+
1919+
The *deprecated* argument, if ``True``, marks the sub-command as
1920+
deprecated and will issue a warning when used. For example::
1921+
1922+
>>> parser = argparse.ArgumentParser(prog='chicken.py')
1923+
>>> subparsers = parser.add_subparsers()
1924+
>>> fly = subparsers.add_parser('fly', deprecated=True)
1925+
>>> args = parser.parse_args(['fly'])
1926+
chicken.py: warning: command 'fly' is deprecated
1927+
Namespace()
1928+
1929+
All other keyword arguments are passed directly to the
1930+
:class:`!ArgumentParser` constructor.
1931+
1932+
.. versionadded:: 3.13
1933+
Added the *deprecated* parameter.
1934+
1935+
19251936
FileType objects
19261937
^^^^^^^^^^^^^^^^
19271938

Doc/library/asyncio-task.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,9 @@ Timeouts
771771
An :ref:`asynchronous context manager <async-context-managers>`
772772
for cancelling overdue coroutines.
773773

774+
Prefer using :func:`asyncio.timeout` or :func:`asyncio.timeout_at`
775+
rather than instantiating :class:`!Timeout` directly.
776+
774777
``when`` should be an absolute time at which the context should time out,
775778
as measured by the event loop's clock:
776779

Doc/library/pathlib.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,10 @@ Pure paths provide the following methods and properties:
486486
>>> PurePosixPath('my/library').stem
487487
'library'
488488

489+
.. versionchanged:: 3.14
490+
491+
A single dot ("``.``") is considered a valid suffix.
492+
489493

490494
.. method:: PurePath.as_posix()
491495

Include/internal/pycore_cell.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ _PyCell_GetStackRef(PyCellObject *cell)
5353
{
5454
PyObject *value;
5555
#ifdef Py_GIL_DISABLED
56-
value = _Py_atomic_load_ptr(&cell->ob_ref);
56+
value = _PyObject_CAST(_Py_atomic_load_ptr(&cell->ob_ref));
5757
if (value == NULL) {
5858
return PyStackRef_NULL;
5959
}

Lib/ensurepip/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
__all__ = ["version", "bootstrap"]
13-
_PIP_VERSION = "25.3"
13+
_PIP_VERSION = "26.0.1"
1414

1515
# Directory of system wheel packages. Some Linux distribution packaging
1616
# policies recommend against bundling dependencies. For example, Fedora
1.7 MB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Bump the version of pip bundled in ensurepip to version 26.0.1

0 commit comments

Comments
 (0)