Skip to content

Commit 4d487cf

Browse files
Merge branch 'main' into fix-152150
2 parents af07141 + bd4bd3e commit 4d487cf

261 files changed

Lines changed: 24781 additions & 2889 deletions

File tree

Some content is hidden

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

.github/CODEOWNERS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@
6363
.azure-pipelines/ @AA-Turner
6464

6565
# GitHub & related scripts
66-
.github/ @ezio-melotti @hugovk @AA-Turner @webknjaz @itamaro
66+
.github/ @ezio-melotti @hugovk @AA-Turner @webknjaz @itamaro @JacobCoffee
6767
Tools/build/compute-changes.py @AA-Turner @hugovk @webknjaz
6868
Lib/test/test_tools/test_compute_changes.py @AA-Turner @hugovk @webknjaz
6969
Tools/build/verify_ensurepip_wheels.py @AA-Turner @pfmoore @pradyunsg
7070

7171
# Pre-commit
72-
.pre-commit-config.yaml @hugovk
73-
.ruff.toml @hugovk @AlexWaygood @AA-Turner
72+
.pre-commit-config.yaml @hugovk @JacobCoffee
73+
.ruff.toml @hugovk @AlexWaygood @AA-Turner @JacobCoffee
7474

7575
# Patchcheck
7676
Tools/patchcheck/ @AA-Turner @itamaro

.github/workflows/build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,9 @@ jobs:
601601
run: ./configure --prefix="$BUILD_DIR/cross-python" --with-build-python="$BUILD_DIR/host-python/bin/python3"
602602
- name: Install cross Python
603603
run: make -j8 install
604+
- name: Display build info
605+
run: |
606+
"$BUILD_DIR/cross-python/bin/python3" -m test.pythoninfo
604607
- name: Run test subset with host build
605608
run: |
606609
"$BUILD_DIR/cross-python/bin/python3" -m test test_sysconfig test_site test_embed

.github/workflows/jit.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ jobs:
6464
include:
6565
- target: i686-pc-windows-msvc/msvc
6666
architecture: Win32
67-
runner: windows-2025-vs2026
67+
runner: windows-2025
6868
- target: x86_64-pc-windows-msvc/msvc
6969
architecture: x64
70-
runner: windows-2025-vs2026
70+
runner: windows-2025
7171
- target: aarch64-pc-windows-msvc/msvc
7272
architecture: ARM64
7373
runner: windows-11-arm
@@ -183,6 +183,9 @@ jobs:
183183
- name: JIT without optimizations (Debug)
184184
configure_flags: --enable-experimental-jit --with-pydebug
185185
test_env: "PYTHON_UOPS_OPTIMIZE=0"
186+
- name: JIT with stress testing (Debug)
187+
configure_flags: --enable-experimental-jit --with-pydebug
188+
test_env: "PYTHON_JIT_STRESS=1"
186189
- name: JIT with tail calling interpreter
187190
configure_flags: --enable-experimental-jit --with-tail-call-interp --with-pydebug
188191
use_clang: true

.github/workflows/reusable-san.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ jobs:
8686
run: >-
8787
./python -m test
8888
${{ inputs.sanitizer == 'TSan' && '--tsan' || '' }}
89-
-j4 -W
89+
-j4 -W --timeout=900 --slowest
9090
- name: Parallel tests
9191
if: >-
9292
inputs.sanitizer == 'TSan'
9393
&& fromJSON(inputs.free-threading)
94-
run: ./python -m test --tsan-parallel --parallel-threads=4 -j4 -W
94+
run: ./python -m test --tsan-parallel --parallel-threads=4 -j4 -W --timeout=600 --slowest
9595
- name: Display logs
9696
if: always()
9797
run: find "${GITHUB_WORKSPACE}" -name 'san_log.*' | xargs head -n 1000

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ env:
1717
jobs:
1818
build:
1919
name: installer for ${{ inputs.arch }}
20-
runs-on: ${{ inputs.arch == 'arm64' && 'windows-11-arm' || 'windows-2025-vs2026' }}
20+
runs-on: ${{ inputs.arch == 'arm64' && 'windows-11-arm' || 'windows-2025' }}
2121
timeout-minutes: 60
2222
env:
2323
ARCH: ${{ inputs.arch }}

.github/workflows/reusable-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ env:
2626
jobs:
2727
build:
2828
name: Build and test (${{ inputs.arch }}, ${{ inputs.interpreter }})
29-
runs-on: ${{ inputs.arch == 'arm64' && 'windows-11-arm' || 'windows-2025-vs2026' }}
29+
runs-on: ${{ inputs.arch == 'arm64' && 'windows-11-arm' || 'windows-2025' }}
3030
timeout-minutes: 60
3131
env:
3232
ARCH: ${{ inputs.arch }}

.readthedocs.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,21 @@ build:
1111
os: ubuntu-24.04
1212
tools:
1313
python: "3"
14+
apt_packages:
15+
- jq
1416

1517
jobs:
16-
post_checkout:
18+
post_system_dependencies:
1719
# https://docs.readthedocs.com/platform/stable/guides/build/skip-build.html#skip-builds-based-on-conditions
1820
#
19-
# Cancel building pull requests when there aren't changes in the Doc
21+
# Cancel building pull requests when there are no changes in the Doc
2022
# directory or RTD configuration, or if we can't cleanly merge the base
2123
# branch.
2224
- |
2325
set -eEux;
2426
if [ "$READTHEDOCS_VERSION_TYPE" = "external" ];
2527
then
26-
base_branch=main;
28+
base_branch=$(wget -qO- "https://api.github.com/repos/python/cpython/pulls/$READTHEDOCS_VERSION" | jq -er ".base.ref");
2729
git fetch --depth=50 origin $base_branch:origin-$base_branch;
2830
for attempt in $(seq 10);
2931
do

Doc/c-api/bytes.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,14 +384,18 @@ Getters
384384
385385
Get the writer size.
386386
387+
The function does not invalidate pointers returned by
388+
:c:func:`PyBytesWriter_GetData`.
389+
387390
The function cannot fail.
388391
389392
.. c:function:: void* PyBytesWriter_GetData(PyBytesWriter *writer)
390393
391394
Get the writer data: start of the internal buffer.
392395
393-
The pointer is valid until :c:func:`PyBytesWriter_Finish` or
394-
:c:func:`PyBytesWriter_Discard` is called on *writer*.
396+
The pointer remains valid until a :c:type:`PyBytesWriter` function other
397+
than :c:func:`PyBytesWriter_GetData` or :c:func:`PyBytesWriter_GetSize` is
398+
called on *writer*.
395399
396400
The function cannot fail.
397401

Doc/c-api/extension-modules.rst

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,35 @@ For example, a module called ``spam`` would be defined like this::
100100
The export hook is typically the only non-\ ``static``
101101
item defined in the module's C source.
102102

103-
The hook should be kept short -- ideally, one line as above.
104-
If you do need to use Python C API in this function, it is recommended to call
105-
``PyABIInfo_Check(&abi_info, "modulename")`` first to raise an exception,
106-
rather than crash, in common cases of ABI mismatch.
103+
.. _pymodexport-api-caveats:
107104

105+
The hook should be kept short.
106+
If it does more than ``return`` a static array, several caveats apply:
107+
108+
- If you need to use any Python C API, it is recommended to call
109+
:c:func:`PyABIInfo_Check` first to raise an exception,
110+
rather than crash, in common cases of ABI mismatch.
111+
- Code in the export hook must never rely on the :term:`GIL`:
112+
:term:`free-threaded builds <free-threaded build>` of Python can only check
113+
the :c:macro:`Py_mod_gil` slot (or the lack of it) after the hook returns,
114+
- Similarly, the hook may be called in any subinterpreter, since the
115+
:c:macro:`Py_mod_multiple_interpreters` slot (or lack of it)
116+
is only checked after the hook returns.
117+
118+
For example::
119+
120+
PyMODEXPORT_FUNC
121+
PyModExport_modulename(void)
122+
{
123+
if (PyABIInfo_Check(&abi_info, "modulename") < 0) {
124+
/* ABI mismatch. It's not safe to examine the raised exception. */
125+
return NULL;
126+
}
127+
128+
/* use Python API (as little as possible); don't rely on GIL */
129+
130+
return modulename_slots;
131+
}
108132

109133
.. note::
110134

Doc/c-api/import.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,11 @@ Importing Modules
304304
305305
Initialization function for a module built into the interpreter.
306306
307+
Note that the inittab uses "``PyInit``"
308+
:ref:`initialization functions <extension-pyinit>`;
309+
there is currently no way to include "``PyModExport_``"
310+
:ref:`export hooks <extension-export-hook>`.
311+
307312
308313
.. c:function:: int PyImport_ExtendInittab(struct _inittab *newtab)
309314

0 commit comments

Comments
 (0)