Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 33c801b

Browse files
committed
Merge branch 'main' into issue-108303-test_doctest
2 parents 2774675 + 939fc6d commit 33c801b

File tree

482 files changed

+17562
-10250
lines changed

Some content is hidden

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

482 files changed

+17562
-10250
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ENV WASI_SDK_VERSION=20
66
ENV WASI_SDK_PATH=/opt/wasi-sdk
77

88
ENV WASMTIME_HOME=/opt/wasmtime
9-
ENV WASMTIME_VERSION=9.0.1
9+
ENV WASMTIME_VERSION=14.0.4
1010
ENV WASMTIME_CPU_ARCH=x86_64
1111

1212
RUN dnf -y --nodocs --setopt=install_weak_deps=False install /usr/bin/{blurb,clang,curl,git,ln,tar,xz} 'dnf-command(builddep)' && \

.github/CODEOWNERS

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,18 @@ Objects/type* @markshannon
2828
Objects/codeobject.c @markshannon
2929
Objects/frameobject.c @markshannon
3030
Objects/call.c @markshannon
31-
Python/ceval.c @markshannon
31+
Python/ceval*.c @markshannon @gvanrossum
32+
Python/ceval*.h @markshannon @gvanrossum
3233
Python/compile.c @markshannon @iritkatriel
3334
Python/assemble.c @markshannon @iritkatriel
3435
Python/flowgraph.c @markshannon @iritkatriel
3536
Python/ast_opt.c @isidentical
37+
Python/bytecodes.c @markshannon @gvanrossum
38+
Python/optimizer*.c @markshannon @gvanrossum
3639
Lib/test/test_patma.py @brandtbucher
3740
Lib/test/test_peepholer.py @brandtbucher
3841
Lib/test/test_type_*.py @JelleZijlstra
42+
Lib/test/test_capi/test_misc.py @markshannon @gvanrossum
3943

4044
# Exceptions
4145
Lib/traceback.py @iritkatriel
@@ -102,6 +106,9 @@ Include/internal/pycore_time.h @pganssle @abalkin
102106
/Lib/tokenize.py @pablogsal @lysnikolaou
103107
/Lib/test/test_tokenize.py @pablogsal @lysnikolaou
104108

109+
# Code generator
110+
/Tools/cases_generator/ @gvanrossum
111+
105112
# AST
106113
Python/ast.c @isidentical
107114
Parser/asdl.py @isidentical
@@ -151,7 +158,7 @@ Doc/c-api/stable.rst @encukou
151158

152159
**/*idlelib* @terryjreedy
153160

154-
**/*typing* @gvanrossum @JelleZijlstra @AlexWaygood
161+
**/*typing* @JelleZijlstra @AlexWaygood
155162

156163
**/*ftplib @giampaolo
157164
**/*shutil @giampaolo

.github/workflows/add-issue-header.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
permissions:
2020
issues: write
2121
steps:
22-
- uses: actions/github-script@v6
22+
- uses: actions/github-script@v7
2323
with:
2424
# language=JavaScript
2525
script: |

.github/workflows/build.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ jobs:
120120

121121
check_generated_files:
122122
name: 'Check if generated files are up to date'
123-
runs-on: ubuntu-latest
123+
# Don't use ubuntu-latest but a specific version to make the job
124+
# reproducible: to get the same tools versions (autoconf, aclocal, ...)
125+
runs-on: ubuntu-22.04
124126
timeout-minutes: 60
125127
needs: check_source
126128
if: needs.check_source.outputs.run_tests == 'true'
@@ -143,15 +145,16 @@ jobs:
143145
- name: Check Autoconf and aclocal versions
144146
run: |
145147
grep "Generated by GNU Autoconf 2.71" configure
146-
grep "aclocal 1.16.4" aclocal.m4
148+
grep "aclocal 1.16.5" aclocal.m4
147149
grep -q "runstatedir" configure
148150
grep -q "PKG_PROG_PKG_CONFIG" aclocal.m4
149151
- name: Configure CPython
150152
run: |
151153
# Build Python with the libpython dynamic library
152154
./configure --config-cache --with-pydebug --enable-shared
153-
- name: Regenerate autoconf files with container image
154-
run: make regen-configure
155+
- name: Regenerate autoconf files
156+
# Same command used by Tools/build/regen-configure.sh ($AUTORECONF)
157+
run: autoreconf -ivf -Werror
155158
- name: Build CPython
156159
run: |
157160
make -j4 regen-all
@@ -187,7 +190,7 @@ jobs:
187190
build_windows_free_threaded:
188191
name: 'Windows (free-threaded)'
189192
needs: check_source
190-
if: needs.check_source.outputs.run_tests == 'true' && contains(github.event.pull_request.labels.*.name, 'topic-free-threaded')
193+
if: needs.check_source.outputs.run_tests == 'true'
191194
uses: ./.github/workflows/reusable-windows.yml
192195
with:
193196
free-threaded: true
@@ -203,7 +206,7 @@ jobs:
203206
build_macos_free_threaded:
204207
name: 'macOS (free-threaded)'
205208
needs: check_source
206-
if: needs.check_source.outputs.run_tests == 'true' && contains(github.event.pull_request.labels.*.name, 'topic-free-threaded')
209+
if: needs.check_source.outputs.run_tests == 'true'
207210
uses: ./.github/workflows/reusable-macos.yml
208211
with:
209212
config_hash: ${{ needs.check_source.outputs.config_hash }}
@@ -225,7 +228,7 @@ jobs:
225228
build_ubuntu_free_threaded:
226229
name: 'Ubuntu (free-threaded)'
227230
needs: check_source
228-
if: needs.check_source.outputs.run_tests == 'true' && contains(github.event.pull_request.labels.*.name, 'topic-free-threaded')
231+
if: needs.check_source.outputs.run_tests == 'true'
229232
uses: ./.github/workflows/reusable-ubuntu.yml
230233
with:
231234
config_hash: ${{ needs.check_source.outputs.config_hash }}
@@ -518,10 +521,7 @@ jobs:
518521
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe
519522
with:
520523
allowed-failures: >-
521-
build_macos_free_threaded,
522-
build_ubuntu_free_threaded,
523524
build_ubuntu_ssltests,
524-
build_windows_free_threaded,
525525
cifuzz,
526526
test_hypothesis,
527527
allowed-skips: >-

.github/workflows/mypy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
pull_request:
99
paths:
1010
- ".github/workflows/mypy.yml"
11+
- "Lib/test/libregrtest/**"
1112
- "Tools/cases_generator/**"
1213
- "Tools/clinic/**"
1314
- "Tools/peg_generator/**"
@@ -32,6 +33,7 @@ jobs:
3233
strategy:
3334
matrix:
3435
target: [
36+
"Lib/test/libregrtest",
3537
"Tools/cases_generator",
3638
"Tools/clinic",
3739
"Tools/peg_generator",

.github/workflows/new-bugs-announce-notifier.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
node-version: 20
1919
- run: npm install mailgun.js form-data
2020
- name: Send notification
21-
uses: actions/github-script@v6
21+
uses: actions/github-script@v7
2222
env:
2323
MAILGUN_API_KEY: ${{ secrets.MAILGUN_PYTHON_ORG_MAILGUN_KEY }}
2424
with:

.github/workflows/posix-deps-apt.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#!/bin/sh
22
apt-get update
33

4+
# autoconf-archive is needed by autoreconf (check_generated_files job)
45
apt-get -yq install \
56
build-essential \
67
pkg-config \
8+
autoconf-archive \
79
ccache \
810
gdb \
911
lcov \

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ Tools/unicode/data/
125125
/config.status.lineno
126126
# hendrikmuhs/ccache-action@v1
127127
/.ccache
128+
/cross-build/
128129
/platform
129130
/profile-clean-stamp
130131
/profile-run-stamp

Doc/c-api/bool.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ are available, however.
2626
.. c:var:: PyObject* Py_False
2727
2828
The Python ``False`` object. This object has no methods and is
29-
`immortal <https://peps.python.org/pep-0683/>`_.
29+
:term:`immortal`.
3030
31-
.. versionchanged:: 3.12
32-
:c:data:`Py_False` is immortal.
31+
.. versionchanged:: 3.12
32+
:c:data:`Py_False` is :term:`immortal`.
3333
3434
3535
.. c:var:: PyObject* Py_True
3636
3737
The Python ``True`` object. This object has no methods and is
38-
`immortal <https://peps.python.org/pep-0683/>`_.
38+
:term:`immortal`.
3939
40-
.. versionchanged:: 3.12
41-
:c:data:`Py_True` is immortal.
40+
.. versionchanged:: 3.12
41+
:c:data:`Py_True` is :term:`immortal`.
4242
4343
4444
.. c:macro:: Py_RETURN_FALSE

Doc/c-api/init.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1485,7 +1485,7 @@ otherwise immutable (e.g. ``None``, ``(1, 5)``) can't normally be shared
14851485
because of the refcount. One simple but less-efficient approach around
14861486
this is to use a global lock around all use of some state (or object).
14871487
Alternately, effectively immutable objects (like integers or strings)
1488-
can be made safe in spite of their refcounts by making them "immortal".
1488+
can be made safe in spite of their refcounts by making them :term:`immortal`.
14891489
In fact, this has been done for the builtin singletons, small integers,
14901490
and a number of other builtin objects.
14911491

Doc/c-api/init_config.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ PyConfig
11701170
11711171
.. c:member:: int show_ref_count
11721172
1173-
Show total reference count at exit (excluding immortal objects)?
1173+
Show total reference count at exit (excluding :term:`immortal` objects)?
11741174
11751175
Set to ``1`` by :option:`-X showrefcount <-X>` command line option.
11761176

Doc/c-api/none.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ same reason.
1616
.. c:var:: PyObject* Py_None
1717
1818
The Python ``None`` object, denoting lack of value. This object has no methods
19-
and is `immortal <https://peps.python.org/pep-0683/>`_.
19+
and is :term:`immortal`.
2020

21-
.. versionchanged:: 3.12
22-
:c:data:`Py_None` is immortal.
21+
.. versionchanged:: 3.12
22+
:c:data:`Py_None` is :term:`immortal`.
2323

2424
.. c:macro:: Py_RETURN_NONE
2525

Doc/c-api/refcounting.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ of Python objects.
1717
1818
Note that the returned value may not actually reflect how many
1919
references to the object are actually held. For example, some
20-
objects are "immortal" and have a very high refcount that does not
20+
objects are :term:`immortal` and have a very high refcount that does not
2121
reflect the actual number of references. Consequently, do not rely
2222
on the returned value to be accurate, other than a value of 0 or 1.
2323
@@ -34,9 +34,10 @@ of Python objects.
3434
3535
Set the object *o* reference counter to *refcnt*.
3636
37-
Note that this function has no effect on
38-
`immortal <https://peps.python.org/pep-0683/>`_
39-
objects.
37+
On :ref:`Python build with Free Threading <free-threading-build>`, if
38+
*refcnt* is larger than ``UINT32_MAX``, the object is made :term:`immortal`.
39+
40+
This function has no effect on :term:`immortal` objects.
4041
4142
.. versionadded:: 3.9
4243
@@ -49,6 +50,8 @@ of Python objects.
4950
Indicate taking a new :term:`strong reference` to object *o*,
5051
indicating it is in use and should not be destroyed.
5152
53+
This function has no effect on :term:`immortal` objects.
54+
5255
This function is usually used to convert a :term:`borrowed reference` to a
5356
:term:`strong reference` in-place. The :c:func:`Py_NewRef` function can be
5457
used to create a new :term:`strong reference`.
@@ -113,6 +116,8 @@ of Python objects.
113116
Release a :term:`strong reference` to object *o*, indicating the
114117
reference is no longer used.
115118
119+
This function has no effect on :term:`immortal` objects.
120+
116121
Once the last :term:`strong reference` is released
117122
(i.e. the object's reference count reaches 0),
118123
the object's type's deallocation

Doc/c-api/set.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ subtypes but not for instances of :class:`frozenset` or its subtypes.
147147
148148
Return ``1`` if found and removed, ``0`` if not found (no action taken), and ``-1`` if an
149149
error is encountered. Does not raise :exc:`KeyError` for missing keys. Raise a
150-
:exc:`TypeError` if the *key* is unhashable. Unlike the Python :meth:`~set.discard`
150+
:exc:`TypeError` if the *key* is unhashable. Unlike the Python :meth:`~frozenset.discard`
151151
method, this function does not automatically convert unhashable sets into
152152
temporary frozensets. Raise :exc:`SystemError` if *set* is not an
153153
instance of :class:`set` or its subtype.

Doc/c-api/slice.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ Ellipsis Object
119119
.. c:var:: PyObject *Py_Ellipsis
120120
121121
The Python ``Ellipsis`` object. This object has no methods. Like
122-
:c:data:`Py_None`, it is an `immortal <https://peps.python.org/pep-0683/>`_.
123-
singleton object.
122+
:c:data:`Py_None`, it is an :term:`immortal` singleton object.
124123
125124
.. versionchanged:: 3.12
126125
:c:data:`Py_Ellipsis` is immortal.

Doc/extending/newtypes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ An interesting advantage of using the :c:member:`~PyTypeObject.tp_members` table
296296
descriptors that are used at runtime is that any attribute defined this way can
297297
have an associated doc string simply by providing the text in the table. An
298298
application can use the introspection API to retrieve the descriptor from the
299-
class object, and get the doc string using its :attr:`__doc__` attribute.
299+
class object, and get the doc string using its :attr:`!__doc__` attribute.
300300

301301
As with the :c:member:`~PyTypeObject.tp_methods` table, a sentinel entry with a :c:member:`~PyMethodDef.ml_name` value
302302
of ``NULL`` is required.

Doc/glossary.rst

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ Glossary
502502
.. index:: single: generator expression
503503

504504
generator expression
505-
An expression that returns an iterator. It looks like a normal expression
505+
An :term:`expression` that returns an :term:`iterator`. It looks like a normal expression
506506
followed by a :keyword:`!for` clause defining a loop variable, range,
507507
and an optional :keyword:`!if` clause. The combined expression
508508
generates values for an enclosing function::
@@ -579,6 +579,16 @@ Glossary
579579
:ref:`idle` is a basic editor and interpreter environment
580580
which ships with the standard distribution of Python.
581581

582+
immortal
583+
If an object is immortal, its reference count is never modified, and
584+
therefore it is never deallocated.
585+
586+
Built-in strings and singletons are immortal objects. For example,
587+
:const:`True` and :const:`None` singletons are immmortal.
588+
589+
See `PEP 683 – Immortal Objects, Using a Fixed Refcount
590+
<https://peps.python.org/pep-0683/>`_ for more information.
591+
582592
immutable
583593
An object with a fixed value. Immutable objects include numbers, strings and
584594
tuples. Such an object cannot be altered. A new object has to
@@ -1056,7 +1066,7 @@ Glossary
10561066
reference count
10571067
The number of references to an object. When the reference count of an
10581068
object drops to zero, it is deallocated. Some objects are
1059-
"immortal" and have reference counts that are never modified, and
1069+
:term:`immortal` and have reference counts that are never modified, and
10601070
therefore the objects are never deallocated. Reference counting is
10611071
generally not visible to Python code, but it is a key element of the
10621072
:term:`CPython` implementation. Programmers can call the

0 commit comments

Comments
 (0)