Skip to content

Commit b9f473c

Browse files
Merge branch 'main' into fix-issue21914
* main: (463 commits) pythongh-140601: Add ResourceWarning to iterparse when not closed (pythonGH-140603) pythongh-137969: Fix double evaluation of `ForwardRef`s which rely on globals (python#140974) pythongh-139109: A new tracing JIT compiler frontend for CPython (pythonGH-140310) pythongh-141004: Document `PyErr_RangedSyntaxLocationObject` (python#141521) pythongh-140873: Add support of non-descriptor callables in functools.singledispatchmethod() (pythonGH-140884) pythongh-139653: Add PyUnstable_ThreadState_SetStackProtection() (python#139668) pythongh-141004: Document `PyCode_Optimize` (pythonGH-141378) pythongh-141004: Document C APIs for dictionary keys, values, and items (pythonGH-141009) pythongh-137959: Fix `TIER1_TO_TIER2` macro name in JIT InternalDocs (pythonGH-141496) pythongh-139871: Add `bytearray.take_bytes([n])` to efficiently extract `bytes` (pythonGH-140128) pythongh-140601: Refactor ElementTree.iterparse() tests (pythonGH-141499) pythongh-135801: Add the module parameter to compile() etc (pythonGH-139652) pythongh-140260: fix data race in `_struct` module initialization with subinterpreters (python#140909) pythongh-137109: refactor warning about threads when forking (python#141438) pythongh-141004: Document `PyRun_InteractiveOneObject` (pythonGH-141405) pythongh-124111: Fix TCL 9 thread detection (pythonGH-128103) pythongh-141442: Add escaping to iOS testbed arguments (python#141443) pythongh-140936: Fix JIT assertion crash at finalization if some generator is alive (pythonGH-140969) Add details about JIT build infrastructure and updating dependencies to `Tools/jit` (python#141167) pythongh-141412: Use reliable target URL for urllib example (pythonGH-141428) ...
2 parents fe81eb9 + a486d45 commit b9f473c

File tree

1,512 files changed

+34186
-13017
lines changed

Some content is hidden

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

1,512 files changed

+34186
-13017
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"image": "ghcr.io/python/wasicontainer:latest",
3+
"onCreateCommand": [
4+
// Install common tooling.
5+
"dnf",
6+
"install",
7+
"-y",
8+
// For umask fix below.
9+
"/usr/bin/setfacl"
10+
],
11+
"updateContentCommand": {
12+
// Using the shell for `nproc` usage.
13+
"python": "python3 Tools/wasm/wasi build --quiet -- --with-pydebug -C"
14+
},
15+
"postCreateCommand": {
16+
// https://github.com/orgs/community/discussions/26026
17+
"umask fix: workspace": ["sudo", "setfacl", "-bnR", "."],
18+
"umask fix: /tmp": ["sudo", "setfacl", "-bnR", "/tmp"]
19+
},
20+
"customizations": {
21+
"vscode": {
22+
"extensions": [
23+
// Highlighting for Parser/Python.asdl.
24+
"brettcannon.zephyr-asdl",
25+
// Highlighting for configure.ac.
26+
"maelvalais.autoconf",
27+
// C auto-complete.
28+
"ms-vscode.cpptools",
29+
// Python auto-complete.
30+
"ms-python.python"
31+
],
32+
"settings": {
33+
"C_Cpp.default.compilerPath": "/usr/bin/clang",
34+
"C_Cpp.default.cStandard": "c11",
35+
"C_Cpp.default.defines": [
36+
"CONFIG_64",
37+
"Py_BUILD_CORE"
38+
],
39+
"C_Cpp.default.includePath": [
40+
"${workspaceFolder}/*",
41+
"${workspaceFolder}/Include/**"
42+
],
43+
// https://github.com/microsoft/vscode-cpptools/issues/10732
44+
"C_Cpp.errorSquiggles": "disabled",
45+
"editor.insertSpaces": true,
46+
"editor.rulers": [
47+
80
48+
],
49+
"editor.tabSize": 4,
50+
"editor.trimAutoWhitespace": true,
51+
"files.associations": {
52+
"*.h": "c"
53+
},
54+
"files.encoding": "utf8",
55+
"files.eol": "\n",
56+
"files.insertFinalNewline": true,
57+
"files.trimTrailingWhitespace": true,
58+
"python.analysis.diagnosticSeverityOverrides": {
59+
// Complains about shadowing the stdlib w/ the stdlib.
60+
"reportShadowedImports": "none",
61+
// Doesn't like _frozen_importlib.
62+
"reportMissingImports": "none"
63+
},
64+
"python.analysis.extraPaths": [
65+
"Lib"
66+
],
67+
"[restructuredtext]": {
68+
"editor.tabSize": 3
69+
}
70+
}
71+
}
72+
}
73+
}

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ Include/opcode_ids.h generated
8383
Include/token.h generated
8484
Lib/_opcode_metadata.py generated
8585
Lib/keyword.py generated
86+
Lib/idlelib/help.html generated
8687
Lib/test/certdata/*.pem generated
8788
Lib/test/certdata/*.0 generated
8889
Lib/test/levenshtein_examples.json generated

.github/workflows/build.yml

Lines changed: 25 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -109,20 +109,10 @@ jobs:
109109
python-version: '3.x'
110110
- name: Runner image version
111111
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
112-
- name: Restore config.cache
113-
uses: actions/cache@v4
114-
with:
115-
path: config.cache
116-
# Include env.pythonLocation in key to avoid changes in environment when setup-python updates Python
117-
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}-${{ env.pythonLocation }}
118112
- name: Install dependencies
119113
run: sudo ./.github/workflows/posix-deps-apt.sh
120114
- name: Add ccache to PATH
121115
run: echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
122-
- name: Configure ccache action
123-
uses: hendrikmuhs/[email protected]
124-
with:
125-
save: false
126116
- name: Configure CPython
127117
run: |
128118
# Build Python with the libpython dynamic library
@@ -278,11 +268,6 @@ jobs:
278268
persist-credentials: false
279269
- name: Runner image version
280270
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
281-
- name: Restore config.cache
282-
uses: actions/cache@v4
283-
with:
284-
path: config.cache
285-
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}
286271
- name: Register gcc problem matcher
287272
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
288273
- name: Install dependencies
@@ -304,10 +289,6 @@ jobs:
304289
- name: Add ccache to PATH
305290
run: |
306291
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
307-
- name: Configure ccache action
308-
uses: hendrikmuhs/[email protected]
309-
with:
310-
save: false
311292
- name: Configure CPython
312293
run: ./configure CFLAGS="-fdiagnostics-format=json" --config-cache --enable-slower-safety --with-pydebug --with-openssl="$OPENSSL_DIR"
313294
- name: Build CPython
@@ -339,11 +320,6 @@ jobs:
339320
persist-credentials: false
340321
- name: Runner image version
341322
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
342-
- name: Restore config.cache
343-
uses: actions/cache@v4
344-
with:
345-
path: config.cache
346-
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}
347323
- name: Register gcc problem matcher
348324
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
349325
- name: Install dependencies
@@ -370,10 +346,6 @@ jobs:
370346
- name: Add ccache to PATH
371347
run: |
372348
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
373-
- name: Configure ccache action
374-
uses: hendrikmuhs/[email protected]
375-
with:
376-
save: false
377349
- name: Configure CPython
378350
run: |
379351
./configure CFLAGS="-fdiagnostics-format=json" \
@@ -414,6 +386,29 @@ jobs:
414386
- name: Build and test
415387
run: ./Android/android.py ci --fast-ci ${{ matrix.arch }}-linux-android
416388

389+
build-ios:
390+
name: iOS
391+
needs: build-context
392+
if: needs.build-context.outputs.run-tests == 'true'
393+
timeout-minutes: 60
394+
runs-on: macos-15
395+
steps:
396+
- uses: actions/checkout@v4
397+
with:
398+
persist-credentials: false
399+
400+
# GitHub recommends explicitly selecting the desired Xcode version:
401+
# https://github.com/actions/runner-images/issues/12541#issuecomment-3083850140
402+
# This became a necessity as a result of
403+
# https://github.com/actions/runner-images/issues/12541 and
404+
# https://github.com/actions/runner-images/issues/12751.
405+
- name: Select Xcode version
406+
run: |
407+
sudo xcode-select --switch /Applications/Xcode_16.4.app
408+
409+
- name: Build and test
410+
run: python3 Apple ci iOS --fast-ci --simulator 'iPhone 16e,OS=18.5'
411+
417412
build-wasi:
418413
name: 'WASI'
419414
needs: build-context
@@ -456,10 +451,6 @@ jobs:
456451
- name: Add ccache to PATH
457452
run: |
458453
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
459-
- name: Configure ccache action
460-
uses: hendrikmuhs/[email protected]
461-
with:
462-
save: false
463454
- name: Setup directory envs for out-of-tree builds
464455
run: |
465456
echo "CPYTHON_RO_SRCDIR=$(realpath -m "${GITHUB_WORKSPACE}"/../cpython-ro-srcdir)" >> "$GITHUB_ENV"
@@ -470,11 +461,6 @@ jobs:
470461
run: sudo mount --bind -o ro "$GITHUB_WORKSPACE" "$CPYTHON_RO_SRCDIR"
471462
- name: Runner image version
472463
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
473-
- name: Restore config.cache
474-
uses: actions/cache@v4
475-
with:
476-
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
477-
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}
478464
- name: Configure CPython out-of-tree
479465
working-directory: ${{ env.CPYTHON_BUILDDIR }}
480466
run: |
@@ -558,11 +544,6 @@ jobs:
558544
persist-credentials: false
559545
- name: Runner image version
560546
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
561-
- name: Restore config.cache
562-
uses: actions/cache@v4
563-
with:
564-
path: config.cache
565-
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}
566547
- name: Register gcc problem matcher
567548
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
568549
- name: Install dependencies
@@ -588,11 +569,6 @@ jobs:
588569
- name: Add ccache to PATH
589570
run: |
590571
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
591-
- name: Configure ccache action
592-
uses: hendrikmuhs/[email protected]
593-
with:
594-
save: ${{ github.event_name == 'push' }}
595-
max-size: "200M"
596572
- name: Configure CPython
597573
run: ./configure --config-cache --with-address-sanitizer --without-pymalloc
598574
- name: Build CPython
@@ -639,11 +615,6 @@ jobs:
639615
persist-credentials: false
640616
- name: Runner image version
641617
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
642-
- name: Restore config.cache
643-
uses: actions/cache@v4
644-
with:
645-
path: config.cache
646-
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}
647618
- name: Register gcc problem matcher
648619
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
649620
- name: Set build dir
@@ -723,6 +694,7 @@ jobs:
723694
- build-ubuntu-ssltests-awslc
724695
- build-ubuntu-ssltests-openssl
725696
- build-android
697+
- build-ios
726698
- build-wasi
727699
- test-hypothesis
728700
- build-asan
@@ -759,6 +731,7 @@ jobs:
759731
build-ubuntu-ssltests-awslc,
760732
build-ubuntu-ssltests-openssl,
761733
build-android,
734+
build-ios,
762735
build-wasi,
763736
test-hypothesis,
764737
build-asan,

.github/workflows/jit.yml

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@ jobs:
5757
fail-fast: false
5858
matrix:
5959
target:
60-
- i686-pc-windows-msvc/msvc
61-
- x86_64-pc-windows-msvc/msvc
62-
- aarch64-pc-windows-msvc/msvc
60+
# To re-enable later when we support these.
61+
# - i686-pc-windows-msvc/msvc
62+
# - x86_64-pc-windows-msvc/msvc
63+
# - aarch64-pc-windows-msvc/msvc
6364
- x86_64-apple-darwin/clang
6465
- aarch64-apple-darwin/clang
6566
- x86_64-unknown-linux-gnu/gcc
@@ -68,17 +69,18 @@ jobs:
6869
- true
6970
- false
7071
llvm:
71-
- 19
72+
- 21
7273
include:
73-
- target: i686-pc-windows-msvc/msvc
74-
architecture: Win32
75-
runner: windows-2022
76-
- target: x86_64-pc-windows-msvc/msvc
77-
architecture: x64
78-
runner: windows-2022
79-
- target: aarch64-pc-windows-msvc/msvc
80-
architecture: ARM64
81-
runner: windows-11-arm
74+
# To re-enable later when we support these.
75+
# - target: i686-pc-windows-msvc/msvc
76+
# architecture: Win32
77+
# runner: windows-2022
78+
# - target: x86_64-pc-windows-msvc/msvc
79+
# architecture: x64
80+
# runner: windows-2022
81+
# - target: aarch64-pc-windows-msvc/msvc
82+
# architecture: ARM64
83+
# runner: windows-11-arm
8284
- target: x86_64-apple-darwin/clang
8385
architecture: x86_64
8486
runner: macos-15-intel
@@ -138,7 +140,7 @@ jobs:
138140
fail-fast: false
139141
matrix:
140142
llvm:
141-
- 19
143+
- 21
142144
steps:
143145
- uses: actions/checkout@v4
144146
with:
@@ -166,7 +168,7 @@ jobs:
166168
fail-fast: false
167169
matrix:
168170
llvm:
169-
- 19
171+
- 21
170172
steps:
171173
- uses: actions/checkout@v4
172174
with:
@@ -183,3 +185,27 @@ jobs:
183185
- name: Run tests without optimizations
184186
run: |
185187
PYTHON_UOPS_OPTIMIZE=0 ./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
188+
189+
tail-call-jit:
190+
name: JIT with tail calling interpreter
191+
needs: interpreter
192+
runs-on: ubuntu-24.04
193+
timeout-minutes: 90
194+
strategy:
195+
fail-fast: false
196+
matrix:
197+
llvm:
198+
- 21
199+
steps:
200+
- uses: actions/checkout@v4
201+
with:
202+
persist-credentials: false
203+
- uses: actions/setup-python@v5
204+
with:
205+
python-version: '3.11'
206+
- name: Build with JIT and tailcall
207+
run: |
208+
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
209+
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
210+
CC=clang-${{ matrix.llvm }} ./configure --enable-experimental-jit --with-tail-call-interp --with-pydebug
211+
make all --jobs 4

.github/workflows/mypy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ on:
1616
- "Tools/build/check_extension_modules.py"
1717
- "Tools/build/check_warnings.py"
1818
- "Tools/build/compute-changes.py"
19+
- "Tools/build/consts_getter.py"
1920
- "Tools/build/deepfreeze.py"
2021
- "Tools/build/generate-build-details.py"
2122
- "Tools/build/generate_sbom.py"

.github/workflows/reusable-macos.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,11 @@ jobs:
3636
persist-credentials: false
3737
- name: Runner image version
3838
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
39-
- name: Restore config.cache
40-
uses: actions/cache@v4
41-
with:
42-
path: config.cache
43-
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ inputs.config_hash }}
4439
- name: Install Homebrew dependencies
4540
run: |
46-
brew install pkg-config [email protected] xz gdbm tcl-tk@8 make
41+
brew install pkg-config [email protected] xz gdbm tcl-tk@9 make
4742
# Because alternate versions are not symlinked into place by default:
48-
brew link --overwrite tcl-tk@8
43+
brew link --overwrite tcl-tk@9
4944
- name: Configure CPython
5045
run: |
5146
MACOSX_DEPLOYMENT_TARGET=10.15 \

.github/workflows/reusable-san.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ jobs:
3434
persist-credentials: false
3535
- name: Runner image version
3636
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
37-
- name: Restore config.cache
38-
uses: actions/cache@v4
39-
with:
40-
path: config.cache
41-
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ inputs.sanitizer }}-${{ inputs.config_hash }}
4237
- name: Install dependencies
4338
run: |
4439
sudo ./.github/workflows/posix-deps-apt.sh
@@ -77,11 +72,6 @@ jobs:
7772
- name: Add ccache to PATH
7873
run: |
7974
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
80-
- name: Configure ccache action
81-
uses: hendrikmuhs/[email protected]
82-
with:
83-
save: ${{ github.event_name == 'push' }}
84-
max-size: "200M"
8575
- name: Configure CPython
8676
run: >-
8777
./configure

0 commit comments

Comments
 (0)