Skip to content

Commit 1037bed

Browse files
committed
Merge branch 'main' of https://github.com/python/cpython into pep-828/implementation
2 parents 9b10752 + 036d309 commit 1037bed

1,333 files changed

Lines changed: 18304 additions & 5103 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/dependabot.yml‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@ updates:
2828
cooldown:
2929
default-days: 14
3030

31+
- package-ecosystem: "npm"
32+
directory: "/Platforms/emscripten/browser_test/"
33+
schedule:
34+
interval: "quarterly"
35+
labels: ["OS-emscripten", "skip issue", "skip news"]
36+
groups:
37+
npm:
38+
patterns: ["*"]
39+
cooldown:
40+
default-days: 14
41+
3142
# Release branches: Dependabot only reads this file from the default
3243
# branch, so each branch that should get its own actions bumps needs an
3344
# entry here with `target-branch`. Add one when a new release branch is
@@ -117,3 +128,29 @@ updates:
117128
patterns: ["*"]
118129
cooldown:
119130
default-days: 14
131+
132+
# Only bump bugfix branches for npm. Remove
133+
# the entry when branch goes security-only.
134+
- package-ecosystem: "npm"
135+
target-branch: "3.15"
136+
directory: "/Platforms/emscripten/browser_test/"
137+
schedule:
138+
interval: "quarterly"
139+
labels: ["OS-emscripten", "skip issue", "skip news"]
140+
groups:
141+
npm:
142+
patterns: ["*"]
143+
cooldown:
144+
default-days: 14
145+
146+
- package-ecosystem: "npm"
147+
target-branch: "3.14"
148+
directory: "/Platforms/emscripten/browser_test/"
149+
schedule:
150+
interval: "quarterly"
151+
labels: ["OS-emscripten", "skip issue", "skip news"]
152+
groups:
153+
npm:
154+
patterns: ["*"]
155+
cooldown:
156+
default-days: 14

‎.github/workflows/build.yml‎

Lines changed: 15 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -346,18 +346,28 @@ jobs:
346346
run: python3 Platforms/Android ci --fast-ci ${{ matrix.arch }}-linux-android
347347

348348
build-ios:
349-
name: iOS
349+
name: >-
350+
iOS
351+
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
350352
needs: build-context
351353
if: needs.build-context.outputs.run-ios == 'true'
352354
timeout-minutes: 60
353355
runs-on: macos-26
356+
strategy:
357+
fail-fast: false
358+
matrix:
359+
free-threading:
360+
- false
361+
- true
354362
steps:
355363
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
356364
with:
357365
persist-credentials: false
358366

359367
- name: Build and test
360-
run: python3 Platforms/Apple ci iOS --fast-ci
368+
run: >-
369+
python3 Platforms/Apple ci iOS --fast-ci
370+
${{ fromJSON(matrix.free-threading) && '--abiflags t' || '' }}
361371
362372
build-emscripten:
363373
name: 'Emscripten'
@@ -481,53 +491,6 @@ jobs:
481491
if: fromJSON(needs.build-context.outputs.run-tests)
482492
uses: ./.github/workflows/reusable-test-lazy-imports-all.yml
483493

484-
build-asan:
485-
name: 'Address sanitizer'
486-
runs-on: ${{ matrix.os }}
487-
timeout-minutes: 60
488-
needs: build-context
489-
if: needs.build-context.outputs.run-ubuntu == 'true'
490-
strategy:
491-
fail-fast: false
492-
matrix:
493-
os: [ubuntu-26.04]
494-
env:
495-
OPENSSL_VER: 3.5.9
496-
PYTHONSTRICTEXTENSIONBUILD: 1
497-
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
498-
steps:
499-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
500-
with:
501-
persist-credentials: false
502-
- name: Runner image version
503-
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
504-
- name: Register gcc problem matcher
505-
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
506-
- name: Install dependencies
507-
run: sudo ./.github/workflows/posix-deps-apt.sh
508-
- name: Configure OpenSSL env vars
509-
run: |
510-
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> "$GITHUB_ENV"
511-
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> "$GITHUB_ENV"
512-
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> "$GITHUB_ENV"
513-
- name: 'Restore OpenSSL build'
514-
id: cache-openssl
515-
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
516-
with:
517-
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
518-
key: ${{ matrix.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
519-
- name: Install OpenSSL
520-
if: steps.cache-openssl.outputs.cache-hit != 'true'
521-
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory "$MULTISSL_DIR" --openssl "$OPENSSL_VER" --system Linux
522-
- name: Configure CPython
523-
run: ./configure --config-cache --with-address-sanitizer --without-pymalloc --with-openssl="$OPENSSL_DIR"
524-
- name: Build CPython
525-
run: make -j4
526-
- name: Display build info
527-
run: make pythoninfo
528-
- name: Tests
529-
run: xvfb-run make ci
530-
531494
build-san:
532495
# ${{ '' } is a hack to nest jobs under the same sidebar category.
533496
name: Sanitizers${{ '' }} # zizmor: ignore[obfuscation]
@@ -544,6 +507,9 @@ jobs:
544507
sanitizer:
545508
- TSan
546509
include:
510+
- check-name: Address
511+
sanitizer: ASan
512+
free-threading: false
547513
- check-name: Undefined behavior
548514
sanitizer: UBSan
549515
free-threading: false
@@ -657,7 +623,6 @@ jobs:
657623
- build-wasi
658624
- test-hypothesis
659625
- test-lazy-imports-all
660-
- build-asan
661626
- build-san
662627
- cross-build-linux
663628
- cifuzz
@@ -704,7 +669,6 @@ jobs:
704669
build-ubuntu-installed,
705670
build-ubuntu-ssltests,
706671
test-hypothesis,
707-
build-asan,
708672
build-san,
709673
cross-build-linux,
710674
'

‎.github/workflows/reusable-san.yml‎

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@ jobs:
4343
# please update the versions in `Tools/pixi-packages/variants.yaml` too.
4444
echo "CC=clang" >> "$GITHUB_ENV"
4545
echo "CXX=clang++" >> "$GITHUB_ENV"
46+
- name: ASan option setup
47+
if: inputs.sanitizer == 'ASan'
48+
run: |
49+
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> "$GITHUB_ENV"
50+
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> "$GITHUB_ENV"
51+
echo "ASAN_OPTIONS=${SAN_LOG_OPTION} detect_leaks=0 allocator_may_return_null=1 handle_segv=0" >> "$GITHUB_ENV"
52+
echo "PYTHONSTRICTEXTENSIONBUILD=1" >> "$GITHUB_ENV"
53+
env:
54+
SAN_LOG_OPTION: log_path=${{ github.workspace }}/san_log
4655
- name: TSan option setup
4756
if: inputs.sanitizer == 'TSan'
4857
run: |
@@ -88,24 +97,27 @@ jobs:
8897
- name: Add ccache to PATH
8998
run: |
9099
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
91-
- name: 'Restore OpenSSL build (TSan)'
100+
- name: 'Restore OpenSSL build'
92101
id: cache-openssl
93-
if: inputs.sanitizer == 'TSan'
102+
if: inputs.sanitizer == 'TSan' || inputs.sanitizer == 'ASan'
94103
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
95104
with:
96105
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
97-
key: ${{ env.IMAGE_OS_VERSION }}-multissl-openssl-tsan-${{ env.OPENSSL_VER }}
98-
- name: Install OpenSSL (TSan)
106+
key: >-
107+
${{ env.IMAGE_OS_VERSION }}-multissl-openssl-${{
108+
inputs.sanitizer == 'TSan' && 'tsan-' || ''
109+
}}${{ env.OPENSSL_VER }}
110+
- name: Install OpenSSL
99111
if: >-
100-
inputs.sanitizer == 'TSan'
112+
(inputs.sanitizer == 'TSan' || inputs.sanitizer == 'ASan')
101113
&& steps.cache-openssl.outputs.cache-hit != 'true'
102114
run: >-
103115
python3 Tools/ssl/multissltests.py
104116
--steps=library
105117
--base-directory="${MULTISSL_DIR}"
106118
--openssl="${OPENSSL_VER}"
107119
--system=Linux
108-
--tsan
120+
${{ inputs.sanitizer == 'TSan' && '--tsan' || '' }}
109121
# gh-157958: -O2 instead of the pydebug default -Og to avoid a clang 21
110122
# compile-time blowup on some interpreter files.
111123
# (https://github.com/llvm/llvm-project/issues/179695)
@@ -117,14 +129,20 @@ jobs:
117129
--config-cache
118130
OPT="-O2 -g"
119131
${{
120-
inputs.sanitizer == 'TSan'
132+
inputs.sanitizer == 'ASan'
133+
&& '--with-address-sanitizer --without-pymalloc'
134+
|| inputs.sanitizer == 'TSan'
121135
&& '--with-thread-sanitizer'
122136
|| inputs.sanitizer == 'MSan'
123137
&& '--with-memory-sanitizer'
124138
|| '--with-undefined-behavior-sanitizer --with-strict-overflow'
125139
}}
126140
${{ inputs.sanitizer == 'MSan' && '--with-assertions' || '--with-pydebug' }}
127-
${{ inputs.sanitizer == 'TSan' && '--with-openssl="$OPENSSL_DIR" --with-openssl-rpath=auto' || '' }}
141+
${{
142+
(inputs.sanitizer == 'TSan' || inputs.sanitizer == 'ASan')
143+
&& '--with-openssl="$OPENSSL_DIR" --with-openssl-rpath=auto'
144+
|| ''
145+
}}
128146
${{ inputs.free-threading && '--disable-gil' || '' }}
129147
- name: Build CPython
130148
run: make -j4

‎.gitignore‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ Lib/test/data/*
7676
Apple/iOS/Frameworks/
7777
Apple/iOS/Resources/Info.plist
7878
Apple/testbed/build
79-
Apple/testbed/Python.xcframework/*/bin
80-
Apple/testbed/Python.xcframework/*/include
81-
Apple/testbed/Python.xcframework/*/lib
82-
Apple/testbed/Python.xcframework/*/Python.framework
79+
Platforms/Apple/testbed/Python*.xcframework/*/bin
80+
Platforms/Apple/testbed/Python*.xcframework/*/include
81+
Platforms/Apple/testbed/Python*.xcframework/*/lib
82+
Platforms/Apple/testbed/Python*.xcframework/*/Python*.framework
8383
Apple/testbed/*Testbed.xcodeproj/project.xcworkspace
8484
Apple/testbed/*Testbed.xcodeproj/xcuserdata
8585
Mac/Makefile

‎Doc/builtins/functions.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ are always available. They are listed here in alphabetical order.
110110

111111
.. versionadded:: 3.10
112112

113-
.. versionchanged:: next
113+
.. versionchanged:: 3.16
114114
Added the *stop_value* and *stop_exception* parameters.
115115

116116
.. function:: all(iterable, /)
@@ -1241,7 +1241,7 @@ are always available. They are listed here in alphabetical order.
12411241
for item in iter(input_queue.get_nowait, stop_exception=queue.Empty):
12421242
process_item(item)
12431243

1244-
.. versionchanged:: next
1244+
.. versionchanged:: 3.16
12451245
Added the *stop_exception* parameter
12461246
and allowed passing *stop_value* by keyword.
12471247

‎Doc/builtins/stdtypes.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5254,7 +5254,7 @@ copying.
52545254
.. versionchanged:: 3.5
52555255
The source format is no longer restricted when casting to a byte view.
52565256

5257-
.. versionchanged:: next
5257+
.. versionchanged:: 3.16
52585258
Casting a multi-dimensional F-contiguous view to a one-dimensional
52595259
view is now supported.
52605260

@@ -5331,7 +5331,7 @@ copying.
53315331

53325332
.. versionadded:: 3.3
53335333

5334-
.. versionchanged:: next
5334+
.. versionchanged:: 3.16
53355335
Added the *order* parameter.
53365336

53375337
.. attribute:: readonly

‎Doc/c-api/capsule.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ Refer to :ref:`using-capsules` for more information on using these objects.
119119
.. versionchanged:: 3.3
120120
*no_block* has no effect anymore.
121121
122-
.. versionchanged:: next
122+
.. versionchanged:: 3.16
123123
Submodules are now imported if needed.
124124
125125

‎Doc/c-api/complex.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,5 +198,5 @@ the :ref:`Number Protocol <number>` API or use native complex types, like
198198
199199
.. deprecated:: 3.15
200200
201-
.. versionchanged:: next
201+
.. versionchanged:: 3.16
202202
This function leaves :c:data:`errno` unchanged on success.

‎Doc/c-api/function.rst‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ There are a few functions specific to Python functions.
1414
1515
The C structure used for functions.
1616

17+
In the free-threaded build, direct access to mutable fields requires
18+
synchronization if another thread may modify the function. See
19+
:ref:`freethreading-extensions-howto`.
20+
1721

1822
.. c:var:: PyTypeObject PyFunction_Type
1923
@@ -71,6 +75,11 @@ There are a few functions specific to Python functions.
7175
This is normally a :class:`string <str>` containing the module name,
7276
but can be set to any other object by Python code.
7377
78+
In the free-threaded build, if the attribute may be modified concurrently,
79+
convert the borrowed reference to a strong reference with :c:func:`Py_XNewRef`
80+
immediately, before calling any other Python API. The same applies to
81+
:c:func:`PyFunction_GET_MODULE`.
82+
7483
7584
.. c:function:: PyObject* PyFunction_GetDefaults(PyObject *op)
7685

‎Doc/c-api/import.rst‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,10 @@ Importing Modules
417417
(Custom importers should do this in their
418418
:py:meth:`~importlib.abc.Loader.exec_module` method.)
419419
420+
If the spec's name is dotted and *initfunc* creates the module using only
421+
the last component of the name, the module's :attr:`~module.__name__`
422+
is set to the full name from the spec.
423+
420424
On error, return NULL with an exception set.
421425
422426
.. versionadded:: 3.15

0 commit comments

Comments
 (0)