Skip to content

Commit ab90768

Browse files
authored
Merge branch 'main' into ctypes-no-stgdict
2 parents 2461e50 + 8182319 commit ab90768

File tree

557 files changed

+17899
-11270
lines changed

Some content is hidden

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

557 files changed

+17899
-11270
lines changed

.devcontainer/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ FROM docker.io/library/fedora:37
22

33
ENV CC=clang
44

5-
ENV WASI_SDK_VERSION=20
5+
ENV WASI_SDK_VERSION=21
66
ENV WASI_SDK_PATH=/opt/wasi-sdk
77

88
ENV WASMTIME_HOME=/opt/wasmtime
9-
ENV WASMTIME_VERSION=18.0.2
9+
ENV WASMTIME_VERSION=18.0.3
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/workflows/build.yml

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797
- name: Get a list of the changed documentation-related files
9898
if: github.event_name == 'pull_request'
9999
id: changed-docs-files
100-
uses: Ana06/get-changed-files@v2.2.0
100+
uses: Ana06/get-changed-files@v2.3.0
101101
with:
102102
filter: |
103103
Doc/**
@@ -206,6 +206,8 @@ jobs:
206206
uses: ./.github/workflows/reusable-macos.yml
207207
with:
208208
config_hash: ${{ needs.check_source.outputs.config_hash }}
209+
# macos-14 is M1, macos-13 is Intel
210+
os-matrix: '["macos-14", "macos-13"]'
209211

210212
build_macos_free_threading:
211213
name: 'macOS (free-threading)'
@@ -215,6 +217,8 @@ jobs:
215217
with:
216218
config_hash: ${{ needs.check_source.outputs.config_hash }}
217219
free-threading: true
220+
# macos-14 is M1
221+
os-matrix: '["macos-14"]'
218222

219223
build_ubuntu:
220224
name: 'Ubuntu'
@@ -301,6 +305,14 @@ jobs:
301305
- name: SSL tests
302306
run: ./python Lib/test/ssltests.py
303307

308+
build_wasi:
309+
name: 'WASI'
310+
needs: check_source
311+
if: needs.check_source.outputs.run_tests == 'true'
312+
uses: ./.github/workflows/reusable-wasi.yml
313+
with:
314+
config_hash: ${{ needs.check_source.outputs.config_hash }}
315+
304316
test_hypothesis:
305317
name: "Hypothesis tests on Ubuntu"
306318
runs-on: ubuntu-20.04
@@ -472,6 +484,24 @@ jobs:
472484
- name: Tests
473485
run: xvfb-run make test
474486

487+
build_tsan:
488+
name: 'Thread sanitizer'
489+
needs: check_source
490+
if: needs.check_source.outputs.run_tests == 'true'
491+
uses: ./.github/workflows/reusable-tsan.yml
492+
with:
493+
config_hash: ${{ needs.check_source.outputs.config_hash }}
494+
options: ./configure --config-cache --with-thread-sanitizer --with-pydebug
495+
496+
build_tsan_free_threading:
497+
name: 'Thread sanitizer (free-threading)'
498+
needs: check_source
499+
if: needs.check_source.outputs.run_tests == 'true'
500+
uses: ./.github/workflows/reusable-tsan.yml
501+
with:
502+
config_hash: ${{ needs.check_source.outputs.config_hash }}
503+
options: ./configure --config-cache --disable-gil --with-thread-sanitizer --with-pydebug
504+
475505
# CIFuzz job based on https://google.github.io/oss-fuzz/getting-started/continuous-integration/
476506
cifuzz:
477507
name: CIFuzz
@@ -484,7 +514,8 @@ jobs:
484514
strategy:
485515
fail-fast: false
486516
matrix:
487-
sanitizer: [address, undefined, memory]
517+
# sanitizer: [address, undefined, memory] -- memory skipped temporarily until GH-116886 is solved.
518+
sanitizer: [address, undefined]
488519
steps:
489520
- name: Build fuzzers (${{ matrix.sanitizer }})
490521
id: build
@@ -525,10 +556,13 @@ jobs:
525556
- build_ubuntu
526557
- build_ubuntu_free_threading
527558
- build_ubuntu_ssltests
559+
- build_wasi
528560
- build_windows
529561
- build_windows_free_threading
530562
- test_hypothesis
531563
- build_asan
564+
- build_tsan
565+
- build_tsan_free_threading
532566
- cifuzz
533567

534568
runs-on: ubuntu-latest
@@ -558,9 +592,12 @@ jobs:
558592
build_ubuntu,
559593
build_ubuntu_free_threading,
560594
build_ubuntu_ssltests,
595+
build_wasi,
561596
build_windows,
562597
build_windows_free_threading,
563598
build_asan,
599+
build_tsan,
600+
build_tsan_free_threading,
564601
'
565602
|| ''
566603
}}

.github/workflows/jit.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ jobs:
108108
if: runner.os == 'macOS'
109109
run: |
110110
brew install llvm@${{ matrix.llvm }}
111-
export SDKROOT="$(xcrun --show-sdk-path)"
112-
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }}
111+
SDKROOT="$(xcrun --show-sdk-path)" \
112+
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }}
113113
make all --jobs 4
114114
./python.exe -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3
115115
@@ -134,10 +134,10 @@ jobs:
134134
sudo apt install --yes "gcc-$HOST" qemu-user
135135
${{ !matrix.debug && matrix.compiler == 'clang' && './configure --enable-optimizations' || '' }}
136136
${{ !matrix.debug && matrix.compiler == 'clang' && 'make profile-run-stamp --jobs 4' || '' }}
137-
export CC="${{ matrix.compiler == 'clang' && 'clang --target=$HOST' || '$HOST-gcc' }}"
138-
export CPP="$CC --preprocess"
139-
export HOSTRUNNER=qemu-${{ matrix.architecture }}
140137
export QEMU_LD_PREFIX="/usr/$HOST"
141-
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }} --build=x86_64-linux-gnu --host="$HOST" --with-build-python=../build/bin/python3 --with-pkg-config=no ac_cv_buggy_getaddrinfo=no ac_cv_file__dev_ptc=no ac_cv_file__dev_ptmx=yes
138+
CC="${{ matrix.compiler == 'clang' && 'clang --target=$HOST' || '$HOST-gcc' }}" \
139+
CPP="$CC --preprocess" \
140+
HOSTRUNNER=qemu-${{ matrix.architecture }} \
141+
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }} --build=x86_64-linux-gnu --host="$HOST" --with-build-python=../build/bin/python3 --with-pkg-config=no ac_cv_buggy_getaddrinfo=no ac_cv_file__dev_ptc=no ac_cv_file__dev_ptmx=yes
142142
make all --jobs 4
143143
./python -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ jobs:
2323
- uses: actions/setup-python@v5
2424
with:
2525
python-version: "3.x"
26-
- uses: pre-commit/action@v3.0.0
26+
- uses: pre-commit/action@v3.0.1

.github/workflows/project-updater.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- { project: 32, label: sprint }
2424

2525
steps:
26-
- uses: actions/add-to-project@v0.1.0
26+
- uses: actions/add-to-project@v0.6.0
2727
with:
2828
project-url: https://github.com/orgs/python/projects/${{ matrix.project }}
2929
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}

.github/workflows/reusable-macos.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
required: false
99
type: boolean
1010
default: false
11+
os-matrix:
12+
required: false
13+
type: string
1114

1215
jobs:
1316
build_macos:
@@ -22,10 +25,7 @@ jobs:
2225
strategy:
2326
fail-fast: false
2427
matrix:
25-
os: [
26-
"macos-14", # M1
27-
"macos-13", # Intel
28-
]
28+
os: ${{fromJson(inputs.os-matrix)}}
2929
runs-on: ${{ matrix.os }}
3030
steps:
3131
- uses: actions/checkout@v4

.github/workflows/reusable-tsan.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
config_hash:
5+
required: true
6+
type: string
7+
options:
8+
required: true
9+
type: string
10+
11+
jobs:
12+
build_tsan_reusable:
13+
name: 'Thread sanitizer'
14+
runs-on: ubuntu-22.04
15+
timeout-minutes: 60
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Runner image version
19+
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
20+
- name: Restore config.cache
21+
uses: actions/cache@v4
22+
with:
23+
path: config.cache
24+
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }}
25+
- name: Install Dependencies
26+
run: |
27+
sudo ./.github/workflows/posix-deps-apt.sh
28+
sudo apt install -y clang
29+
# Reduce ASLR to avoid TSAN crashing
30+
sudo sysctl -w vm.mmap_rnd_bits=28
31+
- name: TSAN Option Setup
32+
run: |
33+
echo "TSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/Tools/tsan/supressions.txt" >> $GITHUB_ENV
34+
echo "CC=clang" >> $GITHUB_ENV
35+
echo "CXX=clang++" >> $GITHUB_ENV
36+
- name: Add ccache to PATH
37+
run: |
38+
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
39+
- name: Configure ccache action
40+
uses: hendrikmuhs/ccache-action@v1.2
41+
with:
42+
save: ${{ github.event_name == 'push' }}
43+
max-size: "200M"
44+
- name: Configure CPython
45+
run: ${{ inputs.options }}
46+
- name: Build CPython
47+
run: make -j4
48+
- name: Display build info
49+
run: make pythoninfo
50+
- name: Tests
51+
run: ./python -m test --tsan -j4

.github/workflows/reusable-wasi.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
config_hash:
5+
required: true
6+
type: string
7+
8+
jobs:
9+
build_wasi_reusable:
10+
name: 'build and test'
11+
timeout-minutes: 60
12+
runs-on: ubuntu-20.04
13+
env:
14+
WASMTIME_VERSION: 18.0.3
15+
WASI_SDK_VERSION: 21
16+
WASI_SDK_PATH: /opt/wasi-sdk
17+
CROSS_BUILD_PYTHON: cross-build/build
18+
CROSS_BUILD_WASI: cross-build/wasm32-wasi
19+
steps:
20+
- uses: actions/checkout@v4
21+
# No problem resolver registered as one doesn't currently exist for Clang.
22+
- name: "Install wasmtime"
23+
uses: jcbhmr/setup-wasmtime@v2
24+
with:
25+
wasmtime-version: ${{ env.WASMTIME_VERSION }}
26+
- name: "Restore WASI SDK"
27+
id: cache-wasi-sdk
28+
uses: actions/cache@v4
29+
with:
30+
path: ${{ env.WASI_SDK_PATH }}
31+
key: ${{ runner.os }}-wasi-sdk-${{ env.WASI_SDK_VERSION }}
32+
- name: "Install WASI SDK"
33+
if: steps.cache-wasi-sdk.outputs.cache-hit != 'true'
34+
run: |
35+
mkdir ${{ env.WASI_SDK_PATH }} && \
36+
curl -s -S --location https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${{ env.WASI_SDK_VERSION }}/wasi-sdk-${{ env.WASI_SDK_VERSION }}.0-linux.tar.gz | \
37+
tar --strip-components 1 --directory ${{ env.WASI_SDK_PATH }} --extract --gunzip
38+
- name: "Configure ccache action"
39+
uses: hendrikmuhs/ccache-action@v1.2
40+
with:
41+
save: ${{ github.event_name == 'push' }}
42+
max-size: "200M"
43+
- name: "Add ccache to PATH"
44+
run: echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
45+
- name: "Install Python"
46+
uses: actions/setup-python@v5
47+
with:
48+
python-version: '3.x'
49+
- name: "Restore Python build config.cache"
50+
uses: actions/cache@v4
51+
with:
52+
path: ${{ env.CROSS_BUILD_PYTHON }}/config.cache
53+
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }}
54+
- name: "Configure build Python"
55+
run: python3 Tools/wasm/wasi.py configure-build-python -- --config-cache --with-pydebug
56+
- name: "Make build Python"
57+
run: python3 Tools/wasm/wasi.py make-build-python
58+
- name: "Restore host config.cache"
59+
uses: actions/cache@v4
60+
with:
61+
path: ${{ env.CROSS_BUILD_WASI }}/config.cache
62+
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-wasi-sdk-${{ env.WASI_SDK_VERSION }}-${{ inputs.config_hash }}
63+
- name: "Configure host"
64+
# `--with-pydebug` inferred from configure-build-python
65+
run: python3 Tools/wasm/wasi.py configure-host -- --config-cache
66+
- name: "Make host"
67+
run: python3 Tools/wasm/wasi.py make-host
68+
- name: "Display build info"
69+
run: make --directory ${{ env.CROSS_BUILD_WASI }} pythoninfo
70+
- name: "Test"
71+
run: make --directory ${{ env.CROSS_BUILD_WASI }} test

.github/workflows/stale.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Mark stale pull requests
22

33
on:
44
schedule:
5-
- cron: "0 0 * * *"
5+
- cron: "0 */6 * * *"
66

77
permissions:
88
pull-requests: write

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Lib/test/data/*
6969
/_bootstrap_python
7070
/Makefile
7171
/Makefile.pre
72-
iOSTestbed.*
72+
/iOSTestbed.*
7373
iOS/Frameworks/
7474
iOS/Resources/Info.plist
7575
iOS/testbed/build
@@ -142,7 +142,6 @@ Tools/unicode/data/
142142
/profile-clean-stamp
143143
/profile-run-stamp
144144
/profile-bolt-stamp
145-
/Python/deepfreeze/*.c
146145
/pybuilddir.txt
147146
/pyconfig.h
148147
/python-config

Doc/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ venv:
163163
echo "venv already exists."; \
164164
echo "To recreate it, remove it first with \`make clean-venv'."; \
165165
else \
166+
echo "Creating venv in $(VENVDIR)"; \
166167
$(PYTHON) -m venv $(VENVDIR); \
167168
$(VENVDIR)/bin/python3 -m pip install --upgrade pip; \
168169
$(VENVDIR)/bin/python3 -m pip install -r $(REQUIREMENTS); \

Doc/c-api/code.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,16 @@ bound into a function.
3434
3535
Return the number of free variables in a code object.
3636
37-
.. c:function:: int PyCode_GetFirstFree(PyCodeObject *co)
37+
.. c:function:: int PyUnstable_Code_GetFirstFree(PyCodeObject *co)
3838
3939
Return the position of the first free variable in a code object.
4040
41+
.. versionchanged:: 3.13
42+
43+
Renamed from ``PyCode_GetFirstFree`` as part of :ref:`unstable-c-api`.
44+
The old name is deprecated, but will remain available until the
45+
signature changes again.
46+
4147
.. c:function:: PyCodeObject* PyUnstable_Code_New(int argcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, PyObject *qualname, int firstlineno, PyObject *linetable, PyObject *exceptiontable)
4248
4349
Return a new code object. If you need a dummy code object to create a frame,

Doc/c-api/hash.rst

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
PyHash API
44
----------
55

6-
See also the :c:member:`PyTypeObject.tp_hash` member.
6+
See also the :c:member:`PyTypeObject.tp_hash` member and :ref:`numeric-hash`.
77

88
.. c:type:: Py_hash_t
99
@@ -17,6 +17,29 @@ See also the :c:member:`PyTypeObject.tp_hash` member.
1717

1818
.. versionadded:: 3.2
1919

20+
.. c:macro:: PyHASH_MODULUS
21+
22+
The `Mersenne prime <https://en.wikipedia.org/wiki/Mersenne_prime>`_ ``P = 2**n -1``, used for numeric hash scheme.
23+
24+
.. versionadded:: 3.13
25+
26+
.. c:macro:: PyHASH_BITS
27+
28+
The exponent ``n`` of ``P`` in :c:macro:`PyHASH_MODULUS`.
29+
30+
.. versionadded:: 3.13
31+
32+
.. c:macro:: PyHASH_INF
33+
34+
The hash value returned for a positive infinity.
35+
36+
.. versionadded:: 3.13
37+
38+
.. c:macro:: PyHASH_IMAG
39+
40+
The multiplier used for the imaginary part of a complex number.
41+
42+
.. versionadded:: 3.13
2043

2144
.. c:type:: PyHash_FuncDef
2245

0 commit comments

Comments
 (0)