Skip to content

Commit 7a9c81a

Browse files
committed
Merge remote-tracking branch 'upstream/main' into cpython-coverage.py
2 parents a1b2f61 + e6e3532 commit 7a9c81a

File tree

159 files changed

+3713
-1057
lines changed

Some content is hidden

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

159 files changed

+3713
-1057
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ Lib/test/test_interpreters/ @ericsnowcurrently
247247
/Tools/wasm/ @brettcannon
248248

249249
# SBOM
250+
/Misc/externals.spdx.json @sethmlarson
250251
/Misc/sbom.spdx.json @sethmlarson
251252
/Tools/build/generate_sbom.py @sethmlarson
252253

.github/workflows/jit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ jobs:
7070
runner: ubuntu-latest
7171
compiler: gcc
7272
# These fail because of emulation, not because of the JIT:
73-
exclude: test_unix_events test_init test_process_pool test_shutdown test_multiprocessing_fork test_cmd_line test_faulthandler test_os test_perf_profiler test_posix test_signal test_socket test_subprocess test_threading test_venv
73+
exclude: test_unix_events test_init test_process_pool test_shutdown test_multiprocessing_fork test_cmd_line test_faulthandler test_os test_perf_profiler test_posix test_signal test_socket test_subprocess test_threading test_venv test_external_inspection
7474
- target: aarch64-unknown-linux-gnu/clang
7575
architecture: aarch64
7676
runner: ubuntu-latest
7777
compiler: clang
7878
# These fail because of emulation, not because of the JIT:
79-
exclude: test_unix_events test_init test_process_pool test_shutdown test_multiprocessing_fork test_cmd_line test_faulthandler test_os test_perf_profiler test_posix test_signal test_socket test_subprocess test_threading test_venv
79+
exclude: test_unix_events test_init test_process_pool test_shutdown test_multiprocessing_fork test_cmd_line test_faulthandler test_os test_perf_profiler test_posix test_signal test_socket test_subprocess test_threading test_venv test_external_inspection
8080
env:
8181
CC: ${{ matrix.compiler }}
8282
steps:

Doc/library/abc.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ a helper class :class:`ABC` to alternatively define ABCs through inheritance:
101101
subclass of the ABC. (This class method is called from the
102102
:meth:`~class.__subclasscheck__` method of the ABC.)
103103

104-
This method should return ``True``, ``False`` or ``NotImplemented``. If
104+
This method should return ``True``, ``False`` or :data:`NotImplemented`. If
105105
it returns ``True``, the *subclass* is considered a subclass of this ABC.
106106
If it returns ``False``, the *subclass* is not considered a subclass of
107107
this ABC, even if it would normally be one. If it returns
108-
``NotImplemented``, the subclass check is continued with the usual
108+
:data:`!NotImplemented`, the subclass check is continued with the usual
109109
mechanism.
110110

111111
.. XXX explain the "usual mechanism"

Doc/library/ast.rst

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2183,14 +2183,17 @@ and classes for traversing abstract syntax trees:
21832183
modified to correspond to :pep:`484` "signature type comments",
21842184
e.g. ``(str, int) -> List[str]``.
21852185

2186-
Also, setting ``feature_version`` to a tuple ``(major, minor)``
2187-
will attempt to parse using that Python version's grammar.
2188-
Currently ``major`` must equal to ``3``. For example, setting
2189-
``feature_version=(3, 4)`` will allow the use of ``async`` and
2190-
``await`` as variable names. The lowest supported version is
2191-
``(3, 7)``; the highest is ``sys.version_info[0:2]``.
2192-
2193-
If source contains a null character ('\0'), :exc:`ValueError` is raised.
2186+
Setting ``feature_version`` to a tuple ``(major, minor)`` will result in
2187+
a "best-effort" attempt to parse using that Python version's grammar.
2188+
For example, setting ``feature_version=(3, 9)`` will attempt to disallow
2189+
parsing of :keyword:`match` statements.
2190+
Currently ``major`` must equal to ``3``. The lowest supported version is
2191+
``(3, 7)`` (and this may increase in future Python versions);
2192+
the highest is ``sys.version_info[0:2]``. "Best-effort" attempt means there
2193+
is no guarantee that the parse (or success of the parse) is the same as
2194+
when run on the Python version corresponding to ``feature_version``.
2195+
2196+
If source contains a null character (``\0``), :exc:`ValueError` is raised.
21942197

21952198
.. warning::
21962199
Note that successfully parsing source code into an AST object doesn't

Doc/library/constants.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,27 @@ A small number of constants live in the built-in namespace. They are:
3333
the other type; may be returned by the in-place binary special methods
3434
(e.g. :meth:`~object.__imul__`, :meth:`~object.__iand__`, etc.) for the same purpose.
3535
It should not be evaluated in a boolean context.
36-
``NotImplemented`` is the sole instance of the :data:`types.NotImplementedType` type.
36+
:data:`!NotImplemented` is the sole instance of the :data:`types.NotImplementedType` type.
3737

3838
.. note::
3939

40-
When a binary (or in-place) method returns ``NotImplemented`` the
40+
When a binary (or in-place) method returns :data:`!NotImplemented` the
4141
interpreter will try the reflected operation on the other type (or some
4242
other fallback, depending on the operator). If all attempts return
43-
``NotImplemented``, the interpreter will raise an appropriate exception.
44-
Incorrectly returning ``NotImplemented`` will result in a misleading
45-
error message or the ``NotImplemented`` value being returned to Python code.
43+
:data:`!NotImplemented`, the interpreter will raise an appropriate exception.
44+
Incorrectly returning :data:`!NotImplemented` will result in a misleading
45+
error message or the :data:`!NotImplemented` value being returned to Python code.
4646

4747
See :ref:`implementing-the-arithmetic-operations` for examples.
4848

4949
.. note::
5050

51-
``NotImplementedError`` and ``NotImplemented`` are not interchangeable,
51+
``NotImplementedError`` and :data:`!NotImplemented` are not interchangeable,
5252
even though they have similar names and purposes.
5353
See :exc:`NotImplementedError` for details on when to use it.
5454

5555
.. versionchanged:: 3.9
56-
Evaluating ``NotImplemented`` in a boolean context is deprecated. While
56+
Evaluating :data:`!NotImplemented` in a boolean context is deprecated. While
5757
it currently evaluates as true, it will emit a :exc:`DeprecationWarning`.
5858
It will raise a :exc:`TypeError` in a future version of Python.
5959

Doc/library/datetime.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,9 @@ Supported operations:
12091209

12101210
Naive and aware :class:`!datetime` objects are never equal.
12111211

1212+
If both comparands are aware, and have the same :attr:`!tzinfo` attribute,
1213+
the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and
1214+
the base datetimes are compared.
12121215
If both comparands are aware and have different :attr:`~.datetime.tzinfo`
12131216
attributes, the comparison acts as comparands were first converted to UTC
12141217
datetimes except that the implementation never overflows.
@@ -1222,6 +1225,9 @@ Supported operations:
12221225
Order comparison between naive and aware :class:`.datetime` objects
12231226
raises :exc:`TypeError`.
12241227

1228+
If both comparands are aware, and have the same :attr:`!tzinfo` attribute,
1229+
the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and
1230+
the base datetimes are compared.
12251231
If both comparands are aware and have different :attr:`~.datetime.tzinfo`
12261232
attributes, the comparison acts as comparands were first converted to UTC
12271233
datetimes except that the implementation never overflows.
@@ -1778,8 +1784,8 @@ Naive and aware :class:`!time` objects are never equal.
17781784
Order comparison between naive and aware :class:`!time` objects raises
17791785
:exc:`TypeError`.
17801786

1781-
If both comparands are aware, and have
1782-
the same :attr:`~.time.tzinfo` attribute, the common :attr:`!tzinfo` attribute is
1787+
If both comparands are aware, and have the same :attr:`~.time.tzinfo`
1788+
attribute, the :attr:`!tzinfo` and :attr:`!fold` attributes are
17831789
ignored and the base times are compared. If both comparands are aware and
17841790
have different :attr:`!tzinfo` attributes, the comparands are first adjusted by
17851791
subtracting their UTC offsets (obtained from ``self.utcoffset()``).

Doc/library/enum.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,9 @@ Data Types
400400

401401
results in the call ``int('1a', 16)`` and a value of ``17`` for the member.
402402

403+
..note:: When writing a custom ``__new__``, do not use ``super().__new__`` --
404+
call the appropriate ``__new__`` instead.
405+
403406
.. method:: Enum.__repr__(self)
404407

405408
Returns the string used for *repr()* calls. By default, returns the

Doc/library/exceptions.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,9 @@ The following exceptions are the exceptions that are usually raised.
335335

336336
.. note::
337337

338-
``NotImplementedError`` and ``NotImplemented`` are not interchangeable,
338+
``NotImplementedError`` and :data:`NotImplemented` are not interchangeable,
339339
even though they have similar names and purposes. See
340-
:data:`NotImplemented` for details on when to use it.
340+
:data:`!NotImplemented` for details on when to use it.
341341

342342
.. exception:: OSError([arg])
343343
OSError(errno, strerror[, filename[, winerror[, filename2]]])

Doc/library/http.server.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,12 @@ the ``--cgi`` option::
520520
:mod:`http.server` command line ``--cgi`` support is being removed
521521
because :class:`CGIHTTPRequestHandler` is being removed.
522522

523+
.. warning::
524+
525+
:class:`CGIHTTPRequestHandler` and the ``--cgi`` command line option
526+
are not intended for use by untrusted clients and may be vulnerable
527+
to exploitation. Always use within a secure environment.
528+
523529
.. _http.server-security:
524530

525531
Security Considerations

Doc/library/importlib.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ ABC hierarchy::
265265
when invalidating the caches of all finders on :data:`sys.meta_path`.
266266

267267
.. versionchanged:: 3.4
268-
Returns ``None`` when called instead of ``NotImplemented``.
268+
Returns ``None`` when called instead of :data:`NotImplemented`.
269269

270270

271271
.. class:: PathEntryFinder

0 commit comments

Comments
 (0)