Skip to content

Commit 359df88

Browse files
authored
Merge branch 'main' into match-class-performance
2 parents 30ac89f + c903d76 commit 359df88

File tree

441 files changed

+11355
-5077
lines changed

Some content is hidden

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

441 files changed

+11355
-5077
lines changed

.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/jit.yml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
- true
6969
- false
7070
llvm:
71-
- 19
71+
- 20
7272
include:
7373
- target: i686-pc-windows-msvc/msvc
7474
architecture: Win32
@@ -138,7 +138,7 @@ jobs:
138138
fail-fast: false
139139
matrix:
140140
llvm:
141-
- 19
141+
- 20
142142
steps:
143143
- uses: actions/checkout@v4
144144
with:
@@ -166,7 +166,7 @@ jobs:
166166
fail-fast: false
167167
matrix:
168168
llvm:
169-
- 19
169+
- 20
170170
steps:
171171
- uses: actions/checkout@v4
172172
with:
@@ -183,3 +183,27 @@ jobs:
183183
- name: Run tests without optimizations
184184
run: |
185185
PYTHON_UOPS_OPTIMIZE=0 ./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
186+
187+
tail-call-jit:
188+
name: JIT with tail calling interpreter
189+
needs: interpreter
190+
runs-on: ubuntu-24.04
191+
timeout-minutes: 90
192+
strategy:
193+
fail-fast: false
194+
matrix:
195+
llvm:
196+
- 20
197+
steps:
198+
- uses: actions/checkout@v4
199+
with:
200+
persist-credentials: false
201+
- uses: actions/setup-python@v5
202+
with:
203+
python-version: '3.11'
204+
- name: Build with JIT and tailcall
205+
run: |
206+
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
207+
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
208+
CC=clang-${{ matrix.llvm }} ./configure --enable-experimental-jit --with-tail-call-interp --with-pydebug
209+
make all --jobs 4

.github/workflows/reusable-wasi.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ env:
1313
jobs:
1414
build-wasi-reusable:
1515
name: 'build and test'
16-
runs-on: ubuntu-24.04
16+
runs-on: ubuntu-24.04-arm
1717
timeout-minutes: 60
1818
env:
19-
WASMTIME_VERSION: 38.0.2
19+
WASMTIME_VERSION: 38.0.3
2020
WASI_SDK_VERSION: 25
2121
WASI_SDK_PATH: /opt/wasi-sdk
2222
CROSS_BUILD_PYTHON: cross-build/build
@@ -40,7 +40,7 @@ jobs:
4040
if: steps.cache-wasi-sdk.outputs.cache-hit != 'true'
4141
run: |
4242
mkdir "${WASI_SDK_PATH}" && \
43-
curl -s -S --location "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_VERSION}.0-x86_64-linux.tar.gz" | \
43+
curl -s -S --location "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_VERSION}.0-arm64-linux.tar.gz" | \
4444
tar --strip-components 1 --directory "${WASI_SDK_PATH}" --extract --gunzip
4545
- name: "Configure ccache action"
4646
uses: hendrikmuhs/[email protected]
@@ -60,24 +60,24 @@ jobs:
6060
with:
6161
path: ${{ env.CROSS_BUILD_PYTHON }}/config.cache
6262
# Include env.pythonLocation in key to avoid changes in environment when setup-python updates Python.
63-
# Include the hash of `Tools/wasm/wasi.py` as it may change the environment variables.
63+
# Include the hash of `Tools/wasm/wasi/__main__.py` as it may change the environment variables.
6464
# (Make sure to keep the key in sync with the other config.cache step below.)
65-
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ env.WASI_SDK_VERSION }}-${{ env.WASMTIME_VERSION }}-${{ inputs.config_hash }}-${{ hashFiles('Tools/wasm/wasi.py') }}-${{ env.pythonLocation }}
65+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ env.WASI_SDK_VERSION }}-${{ env.WASMTIME_VERSION }}-${{ inputs.config_hash }}-${{ hashFiles('Tools/wasm/wasi/__main__.py') }}-${{ env.pythonLocation }}
6666
- name: "Configure build Python"
67-
run: python3 Tools/wasm/wasi.py configure-build-python -- --config-cache --with-pydebug
67+
run: python3 Tools/wasm/wasi configure-build-python -- --config-cache --with-pydebug
6868
- name: "Make build Python"
69-
run: python3 Tools/wasm/wasi.py make-build-python
69+
run: python3 Tools/wasm/wasi make-build-python
7070
- name: "Restore host config.cache"
7171
uses: actions/cache@v4
7272
with:
7373
path: ${{ env.CROSS_BUILD_WASI }}/config.cache
7474
# Should be kept in sync with the other config.cache step above.
75-
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ env.WASI_SDK_VERSION }}-${{ env.WASMTIME_VERSION }}-${{ inputs.config_hash }}-${{ hashFiles('Tools/wasm/wasi.py') }}-${{ env.pythonLocation }}
75+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ env.WASI_SDK_VERSION }}-${{ env.WASMTIME_VERSION }}-${{ inputs.config_hash }}-${{ hashFiles('Tools/wasm/wasi/__main__.py') }}-${{ env.pythonLocation }}
7676
- name: "Configure host"
7777
# `--with-pydebug` inferred from configure-build-python
78-
run: python3 Tools/wasm/wasi.py configure-host -- --config-cache
78+
run: python3 Tools/wasm/wasi configure-host -- --config-cache
7979
- name: "Make host"
80-
run: python3 Tools/wasm/wasi.py make-host
80+
run: python3 Tools/wasm/wasi make-host
8181
- name: "Display build info"
8282
run: make --directory "${CROSS_BUILD_WASI}" pythoninfo
8383
- name: "Test"

Apple/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ def lib_non_platform_files(dirname, names):
507507
def create_xcframework(platform: str) -> str:
508508
"""Build an XCframework from the component parts for the platform.
509509
510-
:return: The version number of the Python verion that was packaged.
510+
:return: The version number of the Python version that was packaged.
511511
"""
512512
package_path = CROSS_BUILD_DIR / platform
513513
try:

Apple/iOS/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,17 @@ Once you have a built an XCframework, you can test that framework by running:
224224

225225
$ python Apple test iOS
226226

227+
This test will attempt to find an "SE-class" simulator (i.e., an iPhone SE, or
228+
iPhone 16e, or similar), and run the test suite on the most recent version of
229+
iOS that is available. You can specify a simulator using the `--simulator`
230+
command line argument, providing the name of the simulator (e.g., `--simulator
231+
'iPhone 16 Pro'`). You can also use this argument to control the OS version used
232+
for testing; `--simulator 'iPhone 16 Pro,OS=18.2'` would attempt to run the
233+
tests on an iPhone 16 Pro running iOS 18.2.
234+
235+
If the test runner is executed on GitHub Actions, the `GITHUB_ACTIONS`
236+
environment variable will be exposed to the iOS process at runtime.
237+
227238
### Testing a single-architecture framework
228239

229240
The `Apple/testbed` folder that contains an Xcode project that is able to run

Apple/testbed/TestbedTests/TestbedTests.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ - (void)testPython {
3535
setenv("NO_COLOR", "1", true);
3636
setenv("PYTHON_COLORS", "0", true);
3737

38+
if (getenv("GITHUB_ACTIONS")) {
39+
NSLog(@"Running in a GitHub Actions environment");
40+
}
3841
// Arguments to pass into the test suite runner.
3942
// argv[0] must identify the process; any subsequent arg
4043
// will be handled as if it were an argument to `python -m test`

Apple/testbed/__main__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import argparse
22
import json
3+
import os
34
import re
45
import shutil
56
import subprocess
@@ -78,13 +79,21 @@ def xcode_test(location: Path, platform: str, simulator: str, verbose: bool):
7879
check=True,
7980
)
8081

82+
# Any environment variable prefixed with TEST_RUNNER_ is exposed into the
83+
# test runner environment. There are some variables (like those identifying
84+
# CI platforms) that can be useful to have access to.
85+
test_env = os.environ.copy()
86+
if "GITHUB_ACTIONS" in os.environ:
87+
test_env["TEST_RUNNER_GITHUB_ACTIONS"] = os.environ["GITHUB_ACTIONS"]
88+
8189
print("Running test project...")
8290
# Test execution *can't* be run -quiet; verbose mode
8391
# is how we see the output of the test output.
8492
process = subprocess.Popen(
8593
["xcodebuild", "test-without-building"] + args,
8694
stdout=subprocess.PIPE,
8795
stderr=subprocess.STDOUT,
96+
env=test_env,
8897
)
8998
while line := (process.stdout.readline()).decode(*DECODE_ARGS):
9099
# Strip the timestamp/process prefix from each log line

Doc/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ dist-pdf:
241241
# as otherwise the full latexmk process is run twice.
242242
# ($$ is needed to escape the $; https://www.gnu.org/software/make/manual/make.html#Basics-of-Variable-References)
243243
-sed -i 's/: all-$$(FMT)/:/' build/latex/Makefile
244-
(cd build/latex; $(MAKE) clean && $(MAKE) --jobs=$$((`nproc`+1)) --output-sync LATEXMKOPTS='-quiet' all-pdf && $(MAKE) FMT=pdf zip bz2)
244+
if [ -n "$(filter output-sync,$(value .FEATURES))" ]; then OUTPUTSYNC=--output-sync; else OUTPUTSYNC=; fi && \
245+
(cd build/latex; $(MAKE) clean && $(MAKE) --jobs=$$((`getconf _NPROCESSORS_ONLN`+1)) $$OUTPUTSYNC LATEXMKOPTS='-quiet' all-pdf && $(MAKE) FMT=pdf zip bz2)
245246
cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-a4.zip
246247
cp build/latex/docs-pdf.tar.bz2 dist/python-$(DISTVERSION)-docs-pdf-a4.tar.bz2
247248
@echo "Build finished and archived!"

Doc/c-api/allocation.rst

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,6 @@ Allocating Objects on the Heap
140140
* :c:member:`~PyTypeObject.tp_alloc`
141141

142142

143-
.. c:function:: void PyObject_Del(void *op)
144-
145-
Same as :c:func:`PyObject_Free`.
146-
147143
.. c:var:: PyObject _Py_NoneStruct
148144
149145
Object which is visible in Python as ``None``. This should only be accessed
@@ -156,3 +152,35 @@ Allocating Objects on the Heap
156152
:ref:`moduleobjects`
157153
To allocate and create extension modules.
158154

155+
156+
Deprecated aliases
157+
^^^^^^^^^^^^^^^^^^
158+
159+
These are :term:`soft deprecated` aliases to existing functions and macros.
160+
They exist solely for backwards compatibility.
161+
162+
163+
.. list-table::
164+
:widths: auto
165+
:header-rows: 1
166+
167+
* * Deprecated alias
168+
* Function
169+
* * .. c:macro:: PyObject_NEW(type, typeobj)
170+
* :c:macro:`PyObject_New`
171+
* * .. c:macro:: PyObject_NEW_VAR(type, typeobj, n)
172+
* :c:macro:`PyObject_NewVar`
173+
* * .. c:macro:: PyObject_INIT(op, typeobj)
174+
* :c:func:`PyObject_Init`
175+
* * .. c:macro:: PyObject_INIT_VAR(op, typeobj, n)
176+
* :c:func:`PyObject_InitVar`
177+
* * .. c:macro:: PyObject_MALLOC(n)
178+
* :c:func:`PyObject_Malloc`
179+
* * .. c:macro:: PyObject_REALLOC(p, n)
180+
* :c:func:`PyObject_Realloc`
181+
* * .. c:macro:: PyObject_FREE(p)
182+
* :c:func:`PyObject_Free`
183+
* * .. c:macro:: PyObject_DEL(p)
184+
* :c:func:`PyObject_Free`
185+
* * .. c:macro:: PyObject_Del(p)
186+
* :c:func:`PyObject_Free`

Doc/c-api/buffer.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,10 @@ readonly, format
261261
MUST be consistent for all consumers. For example, :c:expr:`PyBUF_SIMPLE | PyBUF_WRITABLE`
262262
can be used to request a simple writable buffer.
263263

264+
.. c:macro:: PyBUF_WRITEABLE
265+
266+
This is a :term:`soft deprecated` alias to :c:macro:`PyBUF_WRITABLE`.
267+
264268
.. c:macro:: PyBUF_FORMAT
265269
266270
Controls the :c:member:`~Py_buffer.format` field. If set, this field MUST

0 commit comments

Comments
 (0)