8000 Merge branch 'master' into immortal-references · python/cpython@3866ad7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3866ad7

Browse filesBrowse files
Merge branch 'master' into immortal-references
2 parents 0820520 + 0339434 commit 3866ad7

File tree

76 files changed

+1517
-863
lines changed

Some content is hidden

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

76 files changed

+1517
-863
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,10 @@ jobs:
9090
if test -n "$changes"; then
9191
echo "Generated files not up to date."
9292
echo "Perhaps you forgot to run make regen-all or build.bat --regen. ;)"
93-
echo "configure files must be regenerated with a specific, unpatched version of autoconf."
93+
echo "configure files must be regenerated with a specific version of autoconf."
9494
echo "$changes"
95+
echo ""
96+
git diff --staged || true
9597
exit 1
9698
fi
9799
- name: Check exported libpython symbols
@@ -220,7 +222,7 @@ jobs:
220222
strategy:
221223
fail-fast: false
222224
matrix:
223-
openssl_ver: [1.1.1l, 3.0.0]
225+
openssl_ver: [1.1.1l, 3.0.1]
224226
env:
225227
OPENSSL_VER: ${{ matrix.openssl_ver }}
226228
MULTISSL_DIR: ${{ github.workspace }}/multissl

Doc/c-api/apiabiversion.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ See :ref:`stable` for a discussion of API and ABI stability across versions.
6363
.. c:var:: const unsigned long Py_Version
6464
6565
The Python runtime version number encoded in a single constant integer, with
66-
the same format as the c:macro:`PY_VERSION_HEX` macro.
66+
the same format as the :c:macro:`PY_VERSION_HEX` macro.
6767
This contains the Python version used at run time.
6868

6969
.. versionadded:: 3.11

Doc/distutils/sourcedist.rst

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,25 @@ option, for example::
2323

2424
to create a gzipped tarball and a zip file. The available formats are:
2525

26-
+-----------+-------------------------+---------+
27-
| Format | Description | Notes |
28-
+===========+=========================+=========+
29-
| ``zip`` | zip file (:file:`.zip`) | (1),(3) |
30-
+-----------+-------------------------+---------+
31-
| ``gztar`` | gzip'ed tar file | \(2) |
32-
| | (:file:`.tar.gz`) | |
33-
+-----------+-------------------------+---------+
34-
| ``bztar`` | bzip2'ed tar file | |
35-
| | (:file:`.tar.bz2`) | |
36-
+-----------+-------------------------+---------+
37-
| ``xztar`` | xz'ed tar file | |
38-
| | (:file:`.tar.xz`) | |
39-
+-----------+-------------------------+---------+
40-
| ``ztar`` | compressed tar file | \(4) |
41-
| | (:file:`.tar.Z`) | |
42-
+-----------+-------------------------+---------+
43-
| ``tar`` | tar file (:file:`.tar`) | |
44-
+-----------+-------------------------+---------+
26+
+-----------+-------------------------+-------------+
27+
| Format | Description | Notes |
28+
+===========+=========================+=============+
29+
| ``zip`` | zip file (:file:`.zip`) | (1),(3) |
30+
+-----------+-------------------------+-------------+
31+
| ``gztar`` | gzip'ed tar file | \(2) |
32+
| | (:file:`.tar.gz`) | |
33+
+-----------+-------------------------+-------------+
34+
| ``bztar`` | bzip2'ed tar file | \(5) |
35+
| | (:file:`.tar.bz2`) | |
36+
+-----------+-------------------------+-------------+
37+
| ``xztar`` | xz'ed tar file | \(5) |
38+
| | (:file:`.tar.xz`) | |
39+
+-----------+-------------------------+-------------+
40+
| ``ztar`` | compressed tar file | \(5) |
41+
| | (:file:`.tar.Z`) | |
42+
+-----------+-------------------------+-------------+
43+
| ``tar`` | tar file (:file:`.tar`) | \(5) |
44+
+-----------+-------------------------+-------------+
4545

4646
.. versionchanged:: 3.5
4747
Added support for the ``xztar`` format.
@@ -61,6 +61,9 @@ Notes:
6161
(4)
6262
requires the :program:`compress` program. Notice that this format is now
6363
pending for deprecation and will be removed in the future versions of Python.
64+
(5)
65+
deprecated by `PEP 527 <https://www.python.org/dev/peps/pep-0527/>`_;
66+
`PyPI <https://pypi.org>`_ only accepts ``.zip`` and ``.tar.gz`` files.
6467

6568
When using any ``tar`` format (``gztar``, ``bztar``, ``xztar``, ``ztar`` or
6669
``tar``), under Unix you can specify the ``owner`` and ``group`` names

Doc/library/argparse.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1898,6 +1898,12 @@ Argument groups
18981898
Note that any arguments not in your user-defined groups will end up back
18991899
in the usual "positional arguments" and "optional arguments" sections.
19001900

1901+
.. versionchanged:: 3.11
1902+
Calling :meth:`add_argument_group` on an argument group is deprecated.
1903+
This feature was never supported and does not always work correctly.
1904+
The function exists on the API by accident through inheritance and
1905+
will be removed in the future.
1906+
19011907

19021908
Mutual exclusion
19031909
^^^^^^^^^^^^^^^^
@@ -1936,6 +1942,12 @@ Mutual exclusion
19361942
*title* and *description* arguments of
19371943
:meth:`~ArgumentParser.add_argument_group`.
19381944

1945+
.. versionchanged:: 3.11
1946+
Calling :meth:`add_argument_group` or :meth:`add_mutually_exclusive_group`
1947+
on a mutually exclusive group is deprecated. These features were never
1948+
supported and do not always work correctly. The functions exist on the
1949+
API by accident through inheritance and will be removed in the future.
1950+
19391951

19401952
Parser defaults
19411953
^^^^^^^^^^^^^^^

Doc/library/dis.rst

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -474,13 +474,15 @@ the original TOS1.
474474
.. opcode:: END_ASYNC_FOR
475475

476476
Terminates an :keyword:`async for` loop. Handles an exception raised
477-
when awaiting a next item. If TOS is :exc:`StopAsyncIteration` pop 7
477+
when awaiting a next item. If TOS is :exc:`StopAsyncIteration` pop 3
478478
values from the stack and restore the exception state using the second
479-
three of them. Otherwise re-raise the exception using the three values
479+
of them. Otherwise re-raise the exception using the value
480480
from the stack. An exception handler block is removed from the block stack.
481481

482482
.. versionadded:: 3.8
483483

484+
.. versionchanged:: 3.11
485+
Exception representation on the stack now consist of one, not three, items.
484486

485487
.. opcode:: BEFORE_ASYNC_WITH
486488

@@ -561,8 +563,10 @@ iterations of the loop.
561563

562564
.. opcode:: POP_EXCEPT
563565

564-
Pops three values from the stack, which are used to restore the exception state.
566+
Pops a value from the stack, which is used to restore the exception state.
565567

568+
.. versionchanged:: 3.11
569+
Exception representation on the stack now consist of one, not three, items.
566570

567571
.. opcode:: RERAISE
568572

@@ -572,27 +576,32 @@ iterations of the loop.
572576

573577
.. versionadded:: 3.9
574578

579+
.. versionchanged:: 3.11
580+
Exception representation on the stack now consist of one, not three, items.
575581

576582
.. opcode:: PUSH_EXC_INFO
577583

578-
Pops the three values from the stack. Pushes the current exception to the top of the stack.
579-
Pushes the three values originally popped back to the stack.
584+
Pops a value from the stack. Pushes the current exception to the top of the stack.
585+
Pushes the value originally popped back to the stack.
580586
Used in exception handlers.
581587

582588
.. versionadded:: 3.11
583589

584590

585591
.. opcode:: WITH_EXCEPT_START
586592

587-
Calls the function in position 8 on the stack with the top three
588-
items on the stack as arguments.
593+
Calls the function in position 4 on the stack with arguments (type, val, tb)
594+
representing the exception at the top of the stack.
589595
Used to implement the call ``context_manager.__exit__(*exc_info())`` when an exception
590596
has occurred in a :keyword:`with` statement.
591597

592598
.. versionadded:: 3.9
593599
.. versionchanged:: 3.11
594600
The ``__exit__`` function is in position 8 of the stack rather than 7.
595601

602+
.. versionchanged:: 3.11
603+
The ``__exit__`` function is in position 4 of the stack rather than 7.
604+
Exception representation on the stack now consist of one, not three, items.
596605

597606
.. opcode:: POP_EXCEPT_AND_RERAISE
598607

@@ -890,10 +899,9 @@ All of the following opcodes use their arguments.
890899
Performs exception matching for ``except*``. Applies ``split(TOS)`` on
891900
the exception group representing TOS1. Jumps if no match is found.
892901

893-
Pops one item from the stack. If a match was found, pops the 3 items representing
894-
the exception and pushes the 3 item C848 s representing the non-matching part of
895-
the exception group, followed by the 3 items representing the matching part.
896-
In other words, in case of a match it pops 4 items and pushes 6.
902+
Pops one item from the stack (the match type). If a match was found,
903+
next item (the exception) and pushes the non-matching part of the
904+
exception group followed by the matching part.
897905

898906
.. versionadded:: 3.11
899907

@@ -903,8 +911,8 @@ All of the following opcodes use their arguments.
903911
Combines the raised and reraised exceptions list from TOS, into an exception
904912
group to propagate from a try-except* block. Uses the original exception
905913
group from TOS1 to reconstruct the structure of reraised exceptions. Pops
906-
two items from the stack and pushes a triplet representing the exception to
907-
reraise or three ``None`` if there isn't one.
914+
two items from the stack and pushes 0 (for lasti, which is unused) followed
915+
by the exception to reraise or ``None`` if there isn't one.
908916

909917
.. versionadded:: 3.11
910918

Doc/library/glob.rst

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ For example, ``'[?]'`` matches the character ``'?'``.
3636
The :mod:`pathlib` module offers high-level path objects.
3737

3838

39-
.. function:: glob(pathname, *, root_dir=None, dir_fd=None, recursive=False)
39+
.. function:: glob(pathname, *, root_dir=None, dir_fd=None, recursive=False, \
40+
include_hidden=False)
4041

4142
Return a possibly-empty list of path names that match *pathname*, which must be
4243
a string containing a path specification. *pathname* can be either absolute
@@ -64,6 +65,8 @@ For example, ``'[?]'`` matches the character ``'?'``.
6465
pattern is followed by an :data:`os.sep` or :data:`os.altsep` then files will not
6566
match.
6667

68+
If *include_hidden* is true, "``**``" pattern will match hidden directories.
69+
6770
.. audit-event:: glob.glob pathname,recursive glob.glob
6871
.. audit-event:: glob.glob/2 pathname,recursive,root_dir,dir_fd glob.glob
6972

@@ -77,8 +80,12 @@ For example, ``'[?]'`` matches the character ``'?'``.
7780
.. versionchanged:: 3.10
7881
Added the *root_dir* and *dir_fd* parameters.
7982

83+
.. versionchanged:: 3.11
84+
Added the *include_hidden* parameter.
85+
8086

81-
.. function:: iglob(pathname, *, root_dir=None, dir_fd=None, recursive=False)
87+
.. function:: iglob(pathname, *, root_dir=None, dir_fd=None, recursive=False, \
88+
include_hidden=False)
8289

8390
Return an :term:`iterator` which yields the same values as :func:`glob`
8491
without actually storing them all simultaneously.
@@ -92,6 +99,9 @@ For example, ``'[?]'`` matches the character ``'?'``.
9299
.. versionchanged:: 3.10
93100
Added the *root_dir* and *dir_fd* parameters.
94101

102+
.. versionchanged:: 3.11
103+
Added the *include_hidden* parameter.
104+
95105

96106
.. function:: escape(pathname)
97107

Doc/library/stdtypes.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,7 +1463,7 @@ Strings are immutable
14631463
written in a variety of ways:
14641464

14651465
* Single quotes: ``'allows embedded "double" quotes'``
1466-
* Double quotes: ``"allows embedded 'single' quotes"``.
1466+
* Double quotes: ``"allows embedded 'single' quotes"``
14671467
* Triple quoted: ``'''Three single quotes'''``, ``"""Three double quotes"""``
14681468

14691469
Triple quoted strings may span multiple lines - all associated whitespace will
@@ -1789,9 +1789,9 @@ expression support in the :mod:`re` module).
17891789
>>> from keyword import iskeyword
17901790

17911791
>>> 'hello'.isidentifier(), iskeyword('hello')
1792-
True, False
1792+
(True, False)
17931793
>>> 'def'.isidentifier(), iskeyword('def')
1794-
True, True
1794+
(True, True)
17951795

17961796

17971797
.. method:: str.islower()
@@ -2058,7 +2058,7 @@ expression support in the :mod:`re` module).
20582058
.. index::
20592059
single: universal newlines; str.splitlines method
20602060

2061-
.. method:: str.splitlines([keepends])
2061+
.. method:: str.splitlines(keepends=False)
20622062

20632063
Return a list of the lines in the string, breaking at line boundaries. Line
20642064
breaks are not included in the resulting list unless *keepends* is given and
@@ -2471,7 +2471,7 @@ data and are closely related to string objects in a variety of other ways.
24712471
literals, except that a ``b`` prefix is added:
24722472

24732473
* Single quotes: ``b'still allows embedded "double" quotes'``
2474-
* Double quotes: ``b"still allows embedded 'single' quotes"``.
2474+
* Double quotes: ``b"still allows embedded 'single' quotes"``
24752475
* Triple quoted: ``b'''3 single quotes'''``, ``b"""3 double quotes"""``
24762476

24772477
Only ASCII characters are permitted in bytes literals (regardless of the
@@ -4372,9 +4372,9 @@ Dictionaries can be created by placing a comma-separated list of ``key: value``
43724372
pairs within braces, for example: ``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098:
43734373
'jack', 4127: 'sjoerd'}``, or by the :class:`dict` constructor.
43744374

4375-
.. class:: dict(**kwarg)
4376-
dict(mapping, **kwarg)
4377-
dict(iterable, **kwarg)
4375+
.. class:: dict(**kwargs)
4376+
dict(mapping, **kwargs)
4377+
dict(iterable, **kwargs)
43784378
43794379
Return a new dictionary initialized from an optional positional argument
43804380
and a possibly empty set of keyword arguments.

Doc/library/types.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ Standard names are defined for the following types:
239239
The :term:`loader` which loaded the module. Defaults to ``None``.
240240

241241
This attribute is to match :attr:`importlib.machinery.ModuleSpec.loader`
242-
as stored in the attr:`__spec__` object.
242+
as stored in the :attr:`__spec__` object.
243243

244244
.. note::
245245
A future version of Python may stop setting this attribute by default.
@@ -264,7 +264,7 @@ Standard names are defined for the following types:
264264
:attr:`__name__` if the module is a package itself). Defaults to ``None``.
265265

266266
This attribute is to match :attr:`importlib.machinery.ModuleSpec.parent`
267-
as stored in the attr:`__spec__` object.
267+
as stored in the :attr:`__spec__` object.
268268

269269
.. note::
270270
A future version of Python may stop setting this attribute by default.

Doc/library/typing.rst

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -428,12 +428,12 @@ value of type :data:`Any` and assign it to any variable::
428428

429429
from typing import Any
430430

431-
a = None # type: Any
432-
a = [] # OK
433-
a = 2 # OK
431+
a: Any = None
432+
a = [] # OK
433+
a = 2 # OK
434434

435-
s = '' # type: str
436-
s = a # OK
435+
s = '' # Inferred type of 's' is str
436+
s = a # OK
437437

438438
def foo(item: Any) -> int:
439439
# Typechecks; 'item' could be any type,
@@ -1779,11 +1779,10 @@ Asynchronous programming
17791779
correspond to those of :class:`Generator`, for example::
17801780

17811781
from collections.abc import Coroutine
1782-
c = None # type: Coroutine[list[str], str, int]
1783-
...
1784-
x = c.send('hi') # type: list[str]
1782+
c: Coroutine[list[str], str, int] # Some coroutine defined elsewhere
1783+
x = c.send('hi') # Inferred type of 'x' is list[str]
17851784
async def bar() -> None:
1786-
x = await c # type: int
1785+
y = await c # Inferred type of 'y' is int
17871786

17881787
.. versionadded:: 3.5.3
17891788

Doc/library/zipimport.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ and a path within the archive can be specified to only import from a
2323
subdirectory. For example, the path :file:`example.zip/lib/` would only
2424
import from the :file:`lib/` subdirectory within the archive.
2525

26-
Any files may be present in the ZIP archive, but only files :file:`.py` and
27-
:file:`.pyc` are available for import. ZIP import of dynamic modules
26+
Any files may be present in the ZIP archive, but importers are only invoked for
27+
:file:`.py` and :file:`.pyc` files. ZIP import of dynamic modules
2828
(:file:`.pyd`, :file:`.so`) is disallowed. Note that if an archive only contains
2929
:file:`.py` files, Python will not attempt to modify the archive by adding the
3030
corresponding :file:`.pyc` file, meaning that if a ZIP archive

Doc/tutorial/classes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ using the :func:`next` built-in function; this example shows how it all works::
797797
>>> s = 'abc'
798798
>>> it = iter(s)
799799
>>> it
800-
<iterator object at 0x00A1DB50>
800+
<str_iterator object at 0x10c90e650>
801801
>>> next(it)
802802
'a'
803803
>>> next(it)

Doc/using/configure.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,17 @@ General Options
131131

132132
.. versionadded:: 3.11
133133

134+
.. cmdoption:: --enable-pystats
135+
136+
Turn on internal statistics gathering.
137+
138+
The statistics will be dumped to a arbitrary (probably unique) file in
139+
``/tmp/py_stats/``, or ``C:\temp\py_stats\`` on Windows.
140+
141+
Use ``Tools//summarize_stats.py`` to read the stats.
142+
143+
.. versionadded:: 3.11
144+
134145

135146
Install Options
136147
---------------

Doc/whatsnew/3.11.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,11 @@ Other CPython Implementation Changes
195195
reflected in the re-raised exception.
196196
(Contributed by Irit Katriel in :issue:`45711`.)
197197

198+
* The interpreter state's representation of handled exceptions (a.k.a exc_info, or
199+
_PyErr_StackItem) now has only the ``exc_value`` field, ``exc_type`` and ``exc_traceback``
200+
have been removed as their values can be derived from ``exc_value``.
201+
(Contributed by Irit Katriel in :issue:`45711`.)
202+
198203
New Modules
199204
===========
200205

0 commit comments

Comments
 (0)
0