Skip to content

Commit d82e315

Browse files
authored
Merge branch 'main' into issue-101703
2 parents 3e8e61f + dff8e5d commit d82e315

File tree

184 files changed

+3444
-1209
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+3444
-1209
lines changed

.devcontainer/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ ENV WASMTIME_HOME=/opt/wasmtime
99
ENV WASMTIME_VERSION=7.0.0
1010
ENV WASMTIME_CPU_ARCH=x86_64
1111

12-
RUN dnf -y --nodocs install git clang xz python3-blurb dnf-plugins-core && \
13-
dnf -y --nodocs builddep python3 && \
12+
RUN dnf -y --nodocs --setopt=install_weak_deps=False install /usr/bin/{blurb,clang,curl,git,ln,tar,xz} 'dnf-command(builddep)' && \
13+
dnf -y --nodocs --setopt=install_weak_deps=False builddep python3 && \
1414
dnf -y clean all
1515

1616
RUN mkdir ${WASI_SDK_PATH} && \

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
configure* @erlend-aasland @corona10
1212

1313
# asyncio
14-
**/*asyncio* @1st1 @asvetlov @gvanrossum @kumaraditya303
14+
**/*asyncio* @1st1 @asvetlov @gvanrossum @kumaraditya303 @willingc
1515

1616
# Core
1717
**/*context* @1st1

.github/workflows/build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,10 @@ jobs:
308308
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
309309
- name: Install Dependencies
310310
run: sudo ./.github/workflows/posix-deps-apt.sh
311+
- name: Set up GCC-10 for ASAN
312+
uses: egor-tensin/setup-gcc@v1
313+
with:
314+
version: 10
311315
- name: Configure OpenSSL env vars
312316
run: |
313317
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV

.github/workflows/doc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,13 @@ jobs:
5656

5757
# Add pull request annotations for Sphinx nitpicks (missing references)
5858
- name: 'Get list of changed files'
59+
if: github.event_name == 'pull_request'
5960
id: changed_files
6061
uses: Ana06/[email protected]
6162
with:
6263
filter: "Doc/**"
6364
- name: 'Build changed files in nit-picky mode'
65+
if: github.event_name == 'pull_request'
6466
continue-on-error: true
6567
run: |
6668
# Mark files the pull request modified

.github/workflows/require-pr-label.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
jobs:
88
label:
9-
name: DO-NOT-MERGE
9+
name: DO-NOT-MERGE / unresolved review
1010
runs-on: ubuntu-latest
1111
timeout-minutes: 10
1212

@@ -15,4 +15,4 @@ jobs:
1515
with:
1616
mode: exactly
1717
count: 0
18-
labels: "DO-NOT-MERGE"
18+
labels: "DO-NOT-MERGE, awaiting changes, awaiting change review"

Doc/c-api/type.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,15 @@ Type Objects
232232
233233
.. versionadded:: 3.11
234234
235+
.. c:function:: int PyUnstable_Type_AssignVersionTag(PyTypeObject *type)
236+
237+
Attempt to assign a version tag to the given type.
238+
239+
Returns 1 if the type already had a valid version tag or a new one was
240+
assigned, or 0 if a new tag could not be assigned.
241+
242+
.. versionadded:: 3.12
243+
235244
236245
Creating Heap-Allocated Types
237246
.............................

Doc/c-api/unicode.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,15 @@ APIs:
509509
arguments.
510510
511511
512+
.. c:function:: PyObject* PyUnicode_FromObject(PyObject *obj)
513+
514+
Copy an instance of a Unicode subtype to a new true Unicode object if
515+
necessary. If *obj* is already a true Unicode object (not a subtype),
516+
return the reference with incremented refcount.
517+
518+
Objects other than Unicode or its subtypes will cause a :exc:`TypeError`.
519+
520+
512521
.. c:function:: PyObject* PyUnicode_FromEncodedObject(PyObject *obj, \
513522
const char *encoding, const char *errors)
514523
@@ -616,15 +625,6 @@ APIs:
616625
.. versionadded:: 3.3
617626
618627
619-
.. c:function:: PyObject* PyUnicode_FromObject(PyObject *obj)
620-
621-
Copy an instance of a Unicode subtype to a new true Unicode object if
622-
necessary. If *obj* is already a true Unicode object (not a subtype),
623-
return the reference with incremented refcount.
624-
625-
Objects other than Unicode or its subtypes will cause a :exc:`TypeError`.
626-
627-
628628
Locale Encoding
629629
"""""""""""""""
630630

Doc/conf.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@
7676
if venvdir is not None:
7777
exclude_patterns.append(venvdir + '/*')
7878

79+
nitpick_ignore = [
80+
# Do not error nit-picky mode builds when _SubParsersAction.add_parser cannot
81+
# be resolved, as the method is currently undocumented. For context, see
82+
# https://github.com/python/cpython/pull/103289.
83+
('py:meth', '_SubParsersAction.add_parser'),
84+
]
85+
7986
# Disable Docutils smartquotes for several translations
8087
smartquotes_excludes = {
8188
'languages': ['ja', 'fr', 'zh_TW', 'zh_CN'], 'builders': ['man', 'text'],

Doc/constraints.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# We have upper bounds on our transitive dependencies here
2+
# To avoid new releases unexpectedly breaking our build.
3+
# This file can be updated on an ad-hoc basis,
4+
# though it will probably have to be updated
5+
# whenever Doc/requirements.txt is updated.
6+
7+
# Direct dependencies of Sphinx
8+
babel<3
9+
colorama<0.5
10+
imagesize<1.5
11+
Jinja2<3.2
12+
packaging<24
13+
# Pygments==2.15.0 breaks CI
14+
Pygments<2.16,!=2.15.0
15+
requests<3
16+
snowballstemmer<3
17+
sphinxcontrib-applehelp<1.1
18+
sphinxcontrib-devhelp<1.1
19+
sphinxcontrib-htmlhelp<2.1
20+
sphinxcontrib-jsmath<1.1
21+
sphinxcontrib-qthelp<1.1
22+
sphinxcontrib-serializinghtml<1.2
23+
24+
# Direct dependencies of Jinja2 (Jinja is a dependency of Sphinx, see above)
25+
MarkupSafe<2.2
26+
27+
# Direct dependencies of sphinx-lint
28+
polib<1.3
29+
regex<2024

Doc/extending/newtypes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ Here is an example::
337337
}
338338

339339
PyErr_Format(PyExc_AttributeError,
340-
"'%.50s' object has no attribute '%.400s'",
340+
"'%.100s' object has no attribute '%.400s'",
341341
tp->tp_name, name);
342342
return NULL;
343343
}

Doc/howto/argparse.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1+
.. _argparse-tutorial:
2+
13
*****************
24
Argparse Tutorial
35
*****************
46

57
:author: Tshepang Mbambo
68

7-
.. _argparse-tutorial:
9+
.. currentmodule:: argparse
810

911
This tutorial is intended to be a gentle introduction to :mod:`argparse`, the
1012
recommended command-line parsing module in the Python standard library.
1113

1214
.. note::
1315

1416
There are two other modules that fulfill the same task, namely
15-
:mod:`getopt` (an equivalent for :c:func:`getopt` from the C
17+
:mod:`getopt` (an equivalent for ``getopt()`` from the C
1618
language) and the deprecated :mod:`optparse`.
1719
Note also that :mod:`argparse` is based on :mod:`optparse`,
1820
and therefore very similar in terms of usage.
@@ -137,13 +139,13 @@ And running the code:
137139
138140
Here is what's happening:
139141

140-
* We've added the :meth:`add_argument` method, which is what we use to specify
142+
* We've added the :meth:`~ArgumentParser.add_argument` method, which is what we use to specify
141143
which command-line options the program is willing to accept. In this case,
142144
I've named it ``echo`` so that it's in line with its function.
143145

144146
* Calling our program now requires us to specify an option.
145147

146-
* The :meth:`parse_args` method actually returns some data from the
148+
* The :meth:`~ArgumentParser.parse_args` method actually returns some data from the
147149
options specified, in this case, ``echo``.
148150

149151
* The variable is some form of 'magic' that :mod:`argparse` performs for free
@@ -256,7 +258,7 @@ Here is what is happening:
256258

257259
* To show that the option is actually optional, there is no error when running
258260
the program without it. Note that by default, if an optional argument isn't
259-
used, the relevant variable, in this case :attr:`args.verbosity`, is
261+
used, the relevant variable, in this case ``args.verbosity``, is
260262
given ``None`` as a value, which is the reason it fails the truth
261263
test of the :keyword:`if` statement.
262264

@@ -299,7 +301,7 @@ Here is what is happening:
299301
We even changed the name of the option to match that idea.
300302
Note that we now specify a new keyword, ``action``, and give it the value
301303
``"store_true"``. This means that, if the option is specified,
302-
assign the value ``True`` to :data:`args.verbose`.
304+
assign the value ``True`` to ``args.verbose``.
303305
Not specifying it implies ``False``.
304306

305307
* It complains when you specify a value, in true spirit of what flags
@@ -698,7 +700,7 @@ Conflicting options
698700

699701
So far, we have been working with two methods of an
700702
:class:`argparse.ArgumentParser` instance. Let's introduce a third one,
701-
:meth:`add_mutually_exclusive_group`. It allows for us to specify options that
703+
:meth:`~ArgumentParser.add_mutually_exclusive_group`. It allows for us to specify options that
702704
conflict with each other. Let's also change the rest of the program so that
703705
the new functionality makes more sense:
704706
we'll introduce the ``--quiet`` option,

Doc/library/argparse.rst

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ arguments will never be treated as file references.
585585

586586
.. versionchanged:: 3.12
587587
:class:`ArgumentParser` changed encoding and errors to read arguments files
588-
from default (e.g. :func:`locale.getpreferredencoding(False)` and
588+
from default (e.g. :func:`locale.getpreferredencoding(False) <locale.getpreferredencoding>` and
589589
``"strict"``) to :term:`filesystem encoding and error handler`.
590590
Arguments file should be encoded in UTF-8 instead of ANSI Codepage on Windows.
591591

@@ -1191,7 +1191,7 @@ done downstream after the arguments are parsed.
11911191
For example, JSON or YAML conversions have complex error cases that require
11921192
better reporting than can be given by the ``type`` keyword. A
11931193
:exc:`~json.JSONDecodeError` would not be well formatted and a
1194-
:exc:`FileNotFound` exception would not be handled at all.
1194+
:exc:`FileNotFoundError` exception would not be handled at all.
11951195

11961196
Even :class:`~argparse.FileType` has its limitations for use with the ``type``
11971197
keyword. If one argument uses *FileType* and then a subsequent argument fails,
@@ -1445,7 +1445,7 @@ Action classes
14451445
Action classes implement the Action API, a callable which returns a callable
14461446
which processes arguments from the command-line. Any object which follows
14471447
this API may be passed as the ``action`` parameter to
1448-
:meth:`add_argument`.
1448+
:meth:`~ArgumentParser.add_argument`.
14491449

14501450
.. class:: Action(option_strings, dest, nargs=None, const=None, default=None, \
14511451
type=None, choices=None, required=False, help=None, \
@@ -1723,7 +1723,7 @@ Sub-commands
17231723
:class:`ArgumentParser` supports the creation of such sub-commands with the
17241724
:meth:`add_subparsers` method. The :meth:`add_subparsers` method is normally
17251725
called with no arguments and returns a special action object. This object
1726-
has a single method, :meth:`~ArgumentParser.add_parser`, which takes a
1726+
has a single method, :meth:`~_SubParsersAction.add_parser`, which takes a
17271727
command name and any :class:`ArgumentParser` constructor arguments, and
17281728
returns an :class:`ArgumentParser` object that can be modified as usual.
17291729

@@ -1789,7 +1789,7 @@ Sub-commands
17891789
for that particular parser will be printed. The help message will not
17901790
include parent parser or sibling parser messages. (A help message for each
17911791
subparser command, however, can be given by supplying the ``help=`` argument
1792-
to :meth:`add_parser` as above.)
1792+
to :meth:`~_SubParsersAction.add_parser` as above.)
17931793

17941794
::
17951795

@@ -2157,7 +2157,7 @@ the populated namespace and the list of remaining argument strings.
21572157

21582158
.. warning::
21592159
:ref:`Prefix matching <prefix-matching>` rules apply to
2160-
:meth:`parse_known_args`. The parser may consume an option even if it's just
2160+
:meth:`~ArgumentParser.parse_known_args`. The parser may consume an option even if it's just
21612161
a prefix of one of its known options, instead of leaving it in the remaining
21622162
arguments list.
21632163

@@ -2295,3 +2295,17 @@ A partial upgrade path from :mod:`optparse` to :mod:`argparse`:
22952295

22962296
* Replace the OptionParser constructor ``version`` argument with a call to
22972297
``parser.add_argument('--version', action='version', version='<the version>')``.
2298+
2299+
Exceptions
2300+
----------
2301+
2302+
.. exception:: ArgumentError
2303+
2304+
An error from creating or using an argument (optional or positional).
2305+
2306+
The string value of this exception is the message, augmented with
2307+
information about the argument that caused it.
2308+
2309+
.. exception:: ArgumentTypeError
2310+
2311+
Raised when something goes wrong converting a command line string to a type.

Doc/library/asyncio-eventloop.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,9 +1438,7 @@ async/await code consider using the high-level
14381438

14391439
* *stdin* can be any of these:
14401440

1441-
* a file-like object representing a pipe to be connected to the
1442-
subprocess's standard input stream using
1443-
:meth:`~loop.connect_write_pipe`
1441+
* a file-like object
14441442
* the :const:`subprocess.PIPE` constant (default) which will create a new
14451443
pipe and connect it,
14461444
* the value ``None`` which will make the subprocess inherit the file
@@ -1450,9 +1448,7 @@ async/await code consider using the high-level
14501448

14511449
* *stdout* can be any of these:
14521450

1453-
* a file-like object representing a pipe to be connected to the
1454-
subprocess's standard output stream using
1455-
:meth:`~loop.connect_write_pipe`
1451+
* a file-like object
14561452
* the :const:`subprocess.PIPE` constant (default) which will create a new
14571453
pipe and connect it,
14581454
* the value ``None`` which will make the subprocess inherit the file
@@ -1462,9 +1458,7 @@ async/await code consider using the high-level
14621458

14631459
* *stderr* can be any of these:
14641460

1465-
* a file-like object representing a pipe to be connected to the
1466-
subprocess's standard error stream using
1467-
:meth:`~loop.connect_write_pipe`
1461+
* a file-like object
14681462
* the :const:`subprocess.PIPE` constant (default) which will create a new
14691463
pipe and connect it,
14701464
* the value ``None`` which will make the subprocess inherit the file
@@ -1483,6 +1477,11 @@ async/await code consider using the high-level
14831477
as text. :func:`bytes.decode` can be used to convert the bytes returned
14841478
from the stream to text.
14851479

1480+
If a file-like object passed as *stdin*, *stdout* or *stderr* represents a
1481+
pipe, then the other side of this pipe should be registered with
1482+
:meth:`~loop.connect_write_pipe` or :meth:`~loop.connect_read_pipe` for use
1483+
with the event loop.
1484+
14861485
See the constructor of the :class:`subprocess.Popen` class
14871486
for documentation on other arguments.
14881487

@@ -1571,7 +1570,7 @@ Server objects are created by :meth:`loop.create_server`,
15711570
:meth:`loop.create_unix_server`, :func:`start_server`,
15721571
and :func:`start_unix_server` functions.
15731572

1574-
Do not instantiate the class directly.
1573+
Do not instantiate the :class:`Server` class directly.
15751574

15761575
.. class:: Server
15771576

@@ -1662,7 +1661,8 @@ Do not instantiate the class directly.
16621661

16631662
.. attribute:: sockets
16641663

1665-
List of :class:`socket.socket` objects the server is listening on.
1664+
List of socket-like objects, ``asyncio.trsock.TransportSocket``, which
1665+
the server is listening on.
16661666

16671667
.. versionchanged:: 3.7
16681668
Prior to Python 3.7 ``Server.sockets`` used to return an

Doc/library/contextlib.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,15 @@ Functions and classes provided:
304304

305305
This context manager is :ref:`reentrant <reentrant-cms>`.
306306

307+
If the code within the :keyword:`!with` block raises an
308+
:exc:`ExceptionGroup`, suppressed exceptions are removed from the
309+
group. If any exceptions in the group are not suppressed, a group containing them is re-raised.
310+
307311
.. versionadded:: 3.4
308312

313+
.. versionchanged:: 3.12
314+
``suppress`` now supports suppressing exceptions raised as
315+
part of an :exc:`ExceptionGroup`.
309316

310317
.. function:: redirect_stdout(new_target)
311318

Doc/library/copyreg.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ Such constructors may be factory functions or class instances.
2828
.. function:: pickle(type, function, constructor_ob=None)
2929

3030
Declares that *function* should be used as a "reduction" function for objects
31-
of type *type*. *function* should return either a string or a tuple
32-
containing two or three elements. See the :attr:`~pickle.Pickler.dispatch_table`
31+
of type *type*. *function* must return either a string or a tuple
32+
containing two or five elements. See the :attr:`~pickle.Pickler.dispatch_table`
3333
for more details on the interface of *function*.
3434

3535
The *constructor_ob* parameter is a legacy feature and is now ignored, but if

0 commit comments

Comments
 (0)