Skip to content

Commit e9591b2

Browse files
authored
Merge branch '3.12' into backport-f2cb399-3.12
2 parents cdb58a7 + 34fe4af commit e9591b2

File tree

392 files changed

+7257
-2360
lines changed

Some content is hidden

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

392 files changed

+7257
-2360
lines changed

.azure-pipelines/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
displayName: Pre-build checks
66

77
pool:
8-
vmImage: ubuntu-22.04
8+
vmImage: ubuntu-24.04
99

1010
steps:
1111
- template: ./prebuild-checks.yml

.github/workflows/build.yml

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,50 @@ jobs:
9191
name: abi-data
9292
path: ./Doc/data/*.abi
9393

94+
check_autoconf_regen:
95+
name: 'Check if Autoconf files are up to date'
96+
# Don't use ubuntu-latest but a specific version to make the job
97+
# reproducible: to get the same tools versions (autoconf, aclocal, ...)
98+
runs-on: ubuntu-24.04
99+
container:
100+
image: ghcr.io/python/autoconf:2024.10.16.11360930377
101+
timeout-minutes: 60
102+
needs: check_source
103+
if: needs.check_source.outputs.run_tests == 'true'
104+
steps:
105+
- name: Install Git
106+
run: |
107+
apt update && apt install git -yq
108+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
109+
- uses: actions/checkout@v4
110+
with:
111+
fetch-depth: 1
112+
- name: Runner image version
113+
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
114+
- name: Check Autoconf and aclocal versions
115+
run: |
116+
grep "Generated by GNU Autoconf 2.71" configure
117+
grep "aclocal 1.16.5" aclocal.m4
118+
grep -q "runstatedir" configure
119+
grep -q "PKG_PROG_PKG_CONFIG" aclocal.m4
120+
- name: Regenerate autoconf files
121+
# Same command used by Tools/build/regen-configure.sh ($AUTORECONF)
122+
run: autoreconf -ivf -Werror
123+
- name: Check for changes
124+
run: |
125+
git add -u
126+
changes=$(git status --porcelain)
127+
# Check for changes in regenerated files
128+
if test -n "$changes"; then
129+
echo "Generated files not up to date."
130+
echo "Perhaps you forgot to run make regen-configure ;)"
131+
echo "configure files must be regenerated with a specific version of autoconf."
132+
echo "$changes"
133+
echo ""
134+
git diff --staged || true
135+
exit 1
136+
fi
137+
94138
check_generated_files:
95139
name: 'Check if generated files are up to date'
96140
# Don't use ubuntu-latest but a specific version to make the job
@@ -119,19 +163,10 @@ jobs:
119163
uses: hendrikmuhs/[email protected]
120164
with:
121165
save: false
122-
- name: Check Autoconf and aclocal versions
123-
run: |
124-
grep "Generated by GNU Autoconf 2.71" configure
125-
grep "aclocal 1.16.5" aclocal.m4
126-
grep -q "runstatedir" configure
127-
grep -q "PKG_PROG_PKG_CONFIG" aclocal.m4
128166
- name: Configure CPython
129167
run: |
130168
# Build Python with the libpython dynamic library
131169
./configure --config-cache --with-pydebug --enable-shared
132-
- name: Regenerate autoconf files
133-
# Same command used by Tools/build/regen-configure.sh ($AUTORECONF)
134-
run: autoreconf -ivf -Werror
135170
- name: Build CPython
136171
run: |
137172
# Deepfreeze will usually cause global objects to be added or removed,

.github/workflows/reusable-change-detection.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
---
2-
3-
name: Change detection
1+
name: Reusable change detection
42

53
on: # yamllint disable-line rule:truthy
64
workflow_call:

.github/workflows/reusable-docs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Docs
1+
name: Reusable Docs
22

33
on:
44
workflow_call:
@@ -81,7 +81,7 @@ jobs:
8181
- name: 'Set up Python'
8282
uses: actions/setup-python@v5
8383
with:
84-
python-version: '3.12' # known to work with Sphinx 6.2.1
84+
python-version: '3.13' # known to work with Sphinx 7.2.6
8585
cache: 'pip'
8686
cache-dependency-path: 'Doc/requirements-oldest-sphinx.txt'
8787
- name: 'Install build dependencies'
@@ -92,7 +92,7 @@ jobs:
9292
# Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release
9393
doctest:
9494
name: 'Doctest'
95-
runs-on: ubuntu-latest
95+
runs-on: ubuntu-22.04
9696
timeout-minutes: 60
9797
steps:
9898
- uses: actions/checkout@v4

.github/workflows/reusable-macos.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
name: Reusable macOS
2+
13
on:
24
workflow_call:
35
inputs:
@@ -34,7 +36,10 @@ jobs:
3436
path: config.cache
3537
key: ${{ github.job }}-${{ inputs.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }}
3638
- name: Install Homebrew dependencies
37-
run: brew install pkg-config [email protected] xz gdbm tcl-tk
39+
run: |
40+
brew install pkg-config [email protected] xz gdbm tcl-tk@8
41+
# Because alternate versions are not symlinked into place by default:
42+
brew link tcl-tk@8
3843
- name: Configure CPython
3944
run: |
4045
GDBM_CFLAGS="-I$(brew --prefix gdbm)/include" \

.github/workflows/reusable-tsan.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
name: Reusable Thread Sanitizer
2+
13
on:
24
workflow_call:
35
inputs:

.github/workflows/reusable-ubuntu.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
name: Reusable Ubuntu
2+
13
on:
24
workflow_call:
35
inputs:

.github/workflows/reusable-windows-msi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: TestsMSI
1+
name: Reusable Windows MSI
22

33
on:
44
workflow_call:

.github/workflows/reusable-windows.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
name: Reusable Windows
2+
13
on:
24
workflow_call:
35
inputs:

Doc/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ pydoc-topics: build
144144

145145
.PHONY: gettext
146146
gettext: BUILDER = gettext
147-
gettext: SPHINXOPTS += -d build/doctrees-gettext
147+
gettext: override SPHINXOPTS := -d build/doctrees-gettext $(SPHINXOPTS)
148148
gettext: build
149149

150150
.PHONY: htmlview
@@ -294,7 +294,7 @@ check: _ensure-pre-commit
294294

295295
.PHONY: serve
296296
serve:
297-
@echo "The serve target was removed, use htmlview instead (see bpo-36329)"
297+
@echo "The serve target was removed, use htmllive instead (see gh-80510)"
298298

299299
# Targets for daily automated doc build
300300
# By default, Sphinx only rebuilds pages where the page content has changed.

Doc/README.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,5 @@ Bugs in the content should be reported to the
133133

134134
Bugs in the toolset should be reported to the tools themselves.
135135

136-
You can also send a mail to the Python Documentation Team at [email protected],
137-
and we will process your request as soon as possible.
138-
139-
If you want to help the Documentation Team, you are always welcome. Just send
140-
136+
To help with the documentation, or report any problems, please leave a message
137+
on `discuss.python.org <https://discuss.python.org/c/documentation>`_.

Doc/c-api/allocation.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ Allocating Objects on the Heap
1515
.. c:function:: PyObject* PyObject_Init(PyObject *op, PyTypeObject *type)
1616
1717
Initialize a newly allocated object *op* with its type and initial
18-
reference. Returns the initialized object. If *type* indicates that the
19-
object participates in the cyclic garbage detector, it is added to the
20-
detector's set of observed objects. Other fields of the object are not
21-
affected.
18+
reference. Returns the initialized object. Other fields of the object are
19+
not affected.
2220
2321
2422
.. c:function:: PyVarObject* PyObject_InitVar(PyVarObject *op, PyTypeObject *type, Py_ssize_t size)

Doc/c-api/buffer.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ The following fields are not influenced by *flags* and must always be filled in
244244
with the correct values: :c:member:`~Py_buffer.obj`, :c:member:`~Py_buffer.buf`,
245245
:c:member:`~Py_buffer.len`, :c:member:`~Py_buffer.itemsize`, :c:member:`~Py_buffer.ndim`.
246246

247-
248247
readonly, format
249248
~~~~~~~~~~~~~~~~
250249

@@ -253,7 +252,8 @@ readonly, format
253252
Controls the :c:member:`~Py_buffer.readonly` field. If set, the exporter
254253
MUST provide a writable buffer or else report failure. Otherwise, the
255254
exporter MAY provide either a read-only or writable buffer, but the choice
256-
MUST be consistent for all consumers.
255+
MUST be consistent for all consumers. For example, :c:expr:`PyBUF_SIMPLE | PyBUF_WRITABLE`
256+
can be used to request a simple writable buffer.
257257

258258
.. c:macro:: PyBUF_FORMAT
259259
@@ -265,8 +265,9 @@ readonly, format
265265
Since :c:macro:`PyBUF_SIMPLE` is defined as 0, :c:macro:`PyBUF_WRITABLE`
266266
can be used as a stand-alone flag to request a simple writable buffer.
267267

268-
:c:macro:`PyBUF_FORMAT` can be \|'d to any of the flags except :c:macro:`PyBUF_SIMPLE`.
269-
The latter already implies format ``B`` (unsigned bytes).
268+
:c:macro:`PyBUF_FORMAT` must be \|'d to any of the flags except :c:macro:`PyBUF_SIMPLE`, because
269+
the latter already implies format ``B`` (unsigned bytes). :c:macro:`!PyBUF_FORMAT` cannot be
270+
used on its own.
270271

271272

272273
shape, strides, suboffsets

Doc/c-api/import.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,14 @@ Importing Modules
120120
such modules have no way to know that the module object is an unknown (and
121121
probably damaged with respect to the module author's intents) state.
122122
123-
The module's :attr:`__spec__` and :attr:`__loader__` will be set, if
124-
not set already, with the appropriate values. The spec's loader will
125-
be set to the module's ``__loader__`` (if set) and to an instance of
126-
:class:`~importlib.machinery.SourceFileLoader` otherwise.
123+
The module's :attr:`~module.__spec__` and :attr:`~module.__loader__` will be
124+
set, if not set already, with the appropriate values. The spec's loader
125+
will be set to the module's :attr:`!__loader__` (if set) and to an instance
126+
of :class:`~importlib.machinery.SourceFileLoader` otherwise.
127127
128-
The module's :attr:`__file__` attribute will be set to the code object's
129-
:attr:`~codeobject.co_filename`. If applicable, :attr:`__cached__` will also
130-
be set.
128+
The module's :attr:`~module.__file__` attribute will be set to the code
129+
object's :attr:`~codeobject.co_filename`. If applicable,
130+
:attr:`~module.__cached__` will also be set.
131131
132132
This function will reload the module if it was already imported. See
133133
:c:func:`PyImport_ReloadModule` for the intended way to reload a module.
@@ -139,29 +139,29 @@ Importing Modules
139139
:c:func:`PyImport_ExecCodeModuleWithPathnames`.
140140
141141
.. versionchanged:: 3.12
142-
The setting of :attr:`__cached__` and :attr:`__loader__` is
143-
deprecated. See :class:`~importlib.machinery.ModuleSpec` for
142+
The setting of :attr:`~module.__cached__` and :attr:`~module.__loader__`
143+
is deprecated. See :class:`~importlib.machinery.ModuleSpec` for
144144
alternatives.
145145
146146
147147
.. c:function:: PyObject* PyImport_ExecCodeModuleEx(const char *name, PyObject *co, const char *pathname)
148148
149-
Like :c:func:`PyImport_ExecCodeModule`, but the :attr:`__file__` attribute of
150-
the module object is set to *pathname* if it is non-``NULL``.
149+
Like :c:func:`PyImport_ExecCodeModule`, but the :attr:`~module.__file__`
150+
attribute of the module object is set to *pathname* if it is non-``NULL``.
151151
152152
See also :c:func:`PyImport_ExecCodeModuleWithPathnames`.
153153
154154
155155
.. c:function:: PyObject* PyImport_ExecCodeModuleObject(PyObject *name, PyObject *co, PyObject *pathname, PyObject *cpathname)
156156
157-
Like :c:func:`PyImport_ExecCodeModuleEx`, but the :attr:`__cached__`
157+
Like :c:func:`PyImport_ExecCodeModuleEx`, but the :attr:`~module.__cached__`
158158
attribute of the module object is set to *cpathname* if it is
159159
non-``NULL``. Of the three functions, this is the preferred one to use.
160160
161161
.. versionadded:: 3.3
162162
163163
.. versionchanged:: 3.12
164-
Setting :attr:`__cached__` is deprecated. See
164+
Setting :attr:`~module.__cached__` is deprecated. See
165165
:class:`~importlib.machinery.ModuleSpec` for alternatives.
166166
167167

Doc/c-api/init.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1644,7 +1644,11 @@ function. You can create and destroy them using the following functions:
16441644
.check_multi_interp_extensions = 1,
16451645
.gil = PyInterpreterConfig_OWN_GIL,
16461646
};
1647-
PyThreadState *tstate = Py_NewInterpreterFromConfig(&config);
1647+
PyThreadState *tstate = NULL;
1648+
PyStatus status = Py_NewInterpreterFromConfig(&tstate, &config);
1649+
if (PyStatus_Exception(status)) {
1650+
Py_ExitStatusException(status);
1651+
}
16481652
16491653
Note that the config is used only briefly and does not get modified.
16501654
During initialization the config's values are converted into various

Doc/c-api/long.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,15 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
350350
Exactly what values are considered compact is an implementation detail
351351
and is subject to change.
352352
353+
.. versionadded:: 3.12
354+
355+
353356
.. c:function:: Py_ssize_t PyUnstable_Long_CompactValue(const PyLongObject* op)
354357
355358
If *op* is compact, as determined by :c:func:`PyUnstable_Long_IsCompact`,
356359
return its value.
357360
358361
Otherwise, the return value is undefined.
359362
363+
.. versionadded:: 3.12
364+

Doc/c-api/module.rst

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,19 @@ Module Objects
3737
single: __package__ (module attribute)
3838
single: __loader__ (module attribute)
3939
40-
Return a new module object with the :attr:`__name__` attribute set to *name*.
41-
The module's :attr:`__name__`, :attr:`__doc__`, :attr:`__package__`, and
42-
:attr:`__loader__` attributes are filled in (all but :attr:`__name__` are set
43-
to ``None``); the caller is responsible for providing a :attr:`__file__`
44-
attribute.
40+
Return a new module object with :attr:`module.__name__` set to *name*.
41+
The module's :attr:`!__name__`, :attr:`~module.__doc__`,
42+
:attr:`~module.__package__` and :attr:`~module.__loader__` attributes are
43+
filled in (all but :attr:`!__name__` are set to ``None``). The caller is
44+
responsible for setting a :attr:`~module.__file__` attribute.
4545
4646
Return ``NULL`` with an exception set on error.
4747
4848
.. versionadded:: 3.3
4949
5050
.. versionchanged:: 3.4
51-
:attr:`__package__` and :attr:`__loader__` are set to ``None``.
51+
:attr:`~module.__package__` and :attr:`~module.__loader__` are now set to
52+
``None``.
5253
5354
5455
.. c:function:: PyObject* PyModule_New(const char *name)
@@ -77,8 +78,9 @@ Module Objects
7778
single: __name__ (module attribute)
7879
single: SystemError (built-in exception)
7980
80-
Return *module*'s :attr:`__name__` value. If the module does not provide one,
81-
or if it is not a string, :exc:`SystemError` is raised and ``NULL`` is returned.
81+
Return *module*'s :attr:`~module.__name__` value. If the module does not
82+
provide one, or if it is not a string, :exc:`SystemError` is raised and
83+
``NULL`` is returned.
8284
8385
.. versionadded:: 3.3
8486
@@ -108,8 +110,8 @@ Module Objects
108110
single: SystemError (built-in exception)
109111
110112
Return the name of the file from which *module* was loaded using *module*'s
111-
:attr:`__file__` attribute. If this is not defined, or if it is not a
112-
unicode string, raise :exc:`SystemError` and return ``NULL``; otherwise return
113+
:attr:`~module.__file__` attribute. If this is not defined, or if it is not a
114+
string, raise :exc:`SystemError` and return ``NULL``; otherwise return
113115
a reference to a Unicode object.
114116
115117
.. versionadded:: 3.2

0 commit comments

Comments
 (0)