Skip to content

Commit b9841d0

Browse files
committed
Merge branch 'main' into httpupgrade
2 parents 7ae00ea + c87233f commit b9841d0

736 files changed

Lines changed: 18585 additions & 6148 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: 53 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,33 @@ Lib/test/test_type_*.py @JelleZijlstra
4242
Lib/test/test_capi/test_misc.py @markshannon @gvanrossum
4343
Tools/c-analyzer/ @ericsnowcurrently
4444

45+
# dbm
46+
**/*dbm* @corona10 @erlend-aasland @serhiy-storchaka
47+
48+
# runtime state/lifecycle
49+
**/*pylifecycle* @ericsnowcurrently
50+
**/*pystate* @ericsnowcurrently
51+
**/*preconfig* @ericsnowcurrently
52+
**/*initconfig* @ericsnowcurrently
53+
**/*pathconfig* @ericsnowcurrently
54+
**/*sysmodule* @ericsnowcurrently
55+
**/*bltinmodule* @ericsnowcurrently
56+
**/*gil* @ericsnowcurrently
57+
Include/internal/pycore_runtime.h @ericsnowcurrently
58+
Include/internal/pycore_interp.h @ericsnowcurrently
59+
Include/internal/pycore_tstate.h @ericsnowcurrently
60+
Include/internal/pycore_*_state.h @ericsnowcurrently
61+
Include/internal/pycore_*_init.h @ericsnowcurrently
62+
Include/internal/pycore_atexit.h @ericsnowcurrently
63+
Include/internal/pycore_freelist.h @ericsnowcurrently
64+
Include/internal/pycore_global_objects.h @ericsnowcurrently
65+
Include/internal/pycore_obmalloc.h @ericsnowcurrently
66+
Include/internal/pycore_pymem.h @ericsnowcurrently
67+
Modules/main.c @ericsnowcurrently
68+
Programs/_bootstrap_python.c @ericsnowcurrently
69+
Programs/python.c @ericsnowcurrently
70+
Tools/build/generate_global_objects.py @ericsnowcurrently
71+
4572
# Exceptions
4673
Lib/traceback.py @iritkatriel
4774
Lib/test/test_except*.py @iritkatriel
@@ -50,13 +77,13 @@ Objects/exceptions.c @iritkatriel
5077
Python/traceback.c @iritkatriel
5178

5279
# Hashing
53-
**/*hashlib* @tiran
54-
**/*pyhash* @tiran
55-
**/*sha* @tiran
56-
**/*md5* @tiran
57-
**/*blake* @tiran
58-
/Modules/_blake2/** @tiran
59-
/Modules/_sha3/** @tiran
80+
**/*hashlib* @gpshead @tiran
81+
**/*pyhash* @gpshead @tiran
82+
**/sha* @gpshead @tiran
83+
Modules/md5* @gpshead @tiran
84+
**/*blake* @gpshead @tiran
85+
Modules/_blake2/** @gpshead @tiran
86+
Modules/_hacl/** @gpshead
6087

6188
# logging
6289
**/*logging* @vsajip
@@ -76,7 +103,20 @@ Python/traceback.c @iritkatriel
76103
# Import (including importlib).
77104
**/*import* @brettcannon @ericsnowcurrently @ncoghlan @warsaw
78105
/Python/import.c @kumaraditya303
79-
**/*importlib/resources/* @jaraco @warsaw @FFY00
106+
Python/dynload_*.c @ericsnowcurrently
107+
**/*freeze* @ericsnowcurrently
108+
**/*frozen* @ericsnowcurrently
109+
**/*modsupport* @ericsnowcurrently
110+
**/*modulefinder* @ericsnowcurrently
111+
**/*moduleobject* @ericsnowcurrently
112+
**/*multiphase* @ericsnowcurrently
113+
**/*pkgutil* @ericsnowcurrently
114+
**/*pythonrun* @ericsnowcurrently
115+
**/*runpy* @ericsnowcurrently
116+
**/*singlephase* @ericsnowcurrently
117+
Lib/test/test_module/ @ericsnowcurrently
118+
Doc/c-api/module.rst @ericsnowcurrently
119+
**/*importlib/resources/* @jaraco @warsaw @FFY00
80120
**/importlib/metadata/* @jaraco @warsaw
81121

82122
# Dates and times
@@ -120,6 +160,9 @@ Lib/ast.py @isidentical
120160
/Lib/unittest/mock.py @cjw296
121161
/Lib/test/test_unittest/testmock/* @cjw296
122162

163+
# multiprocessing
164+
**/*multiprocessing* @gpshead
165+
123166
# SQLite 3
124167
**/*sqlite* @berkerpeksag @erlend-aasland
125168

@@ -192,6 +235,8 @@ Doc/c-api/stable.rst @encukou
192235
Doc/howto/clinic.rst @erlend-aasland
193236

194237
# Subinterpreters
238+
**/*interpreteridobject.* @ericsnowcurrently
239+
**/*crossinterp* @ericsnowcurrently
195240
Lib/test/support/interpreters/ @ericsnowcurrently
196241
Modules/_xx*interp*module.c @ericsnowcurrently
197242
Lib/test/test_interpreters/ @ericsnowcurrently

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,7 @@ jobs:
454454
uses: hendrikmuhs/ccache-action@v1.2
455455
with:
456456
save: ${{ github.event_name == 'push' }}
457+
max-size: "200M"
457458
- name: Configure CPython
458459
run: ./configure --config-cache --with-address-sanitizer --without-pymalloc
459460
- name: Build CPython

.github/workflows/build_msi.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ jobs:
3232
strategy:
3333
matrix:
3434
type: [x86, x64, arm64]
35+
env:
36+
IncludeFreethreaded: true
3537
steps:
3638
- uses: actions/checkout@v4
3739
- name: Build CPython installer

.github/workflows/jit.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: JIT
2+
on:
3+
pull_request:
4+
paths: '**jit**'
5+
push:
6+
paths: '**jit**'
7+
workflow_dispatch:
8+
jobs:
9+
jit:
10+
name: ${{ matrix.target }} (${{ matrix.debug && 'Debug' || 'Release' }})
11+
runs-on: ${{ matrix.runner }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
target:
16+
- i686-pc-windows-msvc/msvc
17+
- x86_64-pc-windows-msvc/msvc
18+
- x86_64-apple-darwin/clang
19+
- x86_64-unknown-linux-gnu/gcc
20+
- x86_64-unknown-linux-gnu/clang
21+
- aarch64-unknown-linux-gnu/gcc
22+
- aarch64-unknown-linux-gnu/clang
23+
debug:
24+
- true
25+
- false
26+
llvm:
27+
- 16
28+
include:
29+
- target: i686-pc-windows-msvc/msvc
30+
architecture: Win32
31+
runner: windows-latest
32+
compiler: msvc
33+
- target: x86_64-pc-windows-msvc/msvc
34+
architecture: x64
35+
runner: windows-latest
36+
compiler: msvc
37+
- target: x86_64-apple-darwin/clang
38+
architecture: x86_64
39+
runner: macos-latest
40+
compiler: clang
41+
exclude: test_embed
42+
- target: x86_64-unknown-linux-gnu/gcc
43+
architecture: x86_64
44+
runner: ubuntu-latest
45+
compiler: gcc
46+
- target: x86_64-unknown-linux-gnu/clang
47+
architecture: x86_64
48+
runner: ubuntu-latest
49+
compiler: clang
50+
- target: aarch64-unknown-linux-gnu/gcc
51+
architecture: aarch64
52+
runner: ubuntu-latest
53+
compiler: gcc
54+
# These fail because of emulation, not because of the JIT:
55+
exclude: test_unix_events test_init test_process_pool test_shutdown test_multiprocessing_fork test_cmd_line test_faulthandler test_os test_perf_profiler test_posix test_signal test_socket test_subprocess test_threading test_venv
56+
- target: aarch64-unknown-linux-gnu/clang
57+
architecture: aarch64
58+
runner: ubuntu-latest
59+
compiler: clang
60+
# These fail because of emulation, not because of the JIT:
61+
exclude: test_unix_events test_init test_process_pool test_shutdown test_multiprocessing_fork test_cmd_line test_faulthandler test_os test_perf_profiler test_posix test_signal test_socket test_subprocess test_threading test_venv
62+
env:
63+
CC: ${{ matrix.compiler }}
64+
steps:
65+
- uses: actions/checkout@v4
66+
- uses: actions/setup-python@v5
67+
with:
68+
python-version: '3.11'
69+
70+
- name: Windows
71+
if: runner.os == 'Windows'
72+
run: |
73+
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}
74+
./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '--pgo' }} -p ${{ matrix.architecture }}
75+
./PCbuild/rt.bat ${{ matrix.debug && '-d' }} -p ${{ matrix.architecture }} -q --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3
76+
77+
- name: macOS
78+
if: runner.os == 'macOS'
79+
run: |
80+
brew install llvm@${{ matrix.llvm }}
81+
export SDKROOT="$(xcrun --show-sdk-path)"
82+
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }}
83+
make all --jobs 3
84+
./python.exe -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3
85+
86+
- name: Native Linux
87+
if: runner.os == 'Linux' && matrix.architecture == 'x86_64'
88+
run: |
89+
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
90+
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
91+
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }}
92+
make all --jobs 4
93+
./python -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3
94+
- name: Emulated Linux
95+
if: runner.os == 'Linux' && matrix.architecture != 'x86_64'
96+
run: |
97+
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
98+
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
99+
./configure --prefix="$(pwd)/../build"
100+
make install --jobs 4
101+
make clean --jobs 4
102+
export HOST=${{ matrix.architecture }}-linux-gnu
103+
sudo apt install --yes "gcc-$HOST" qemu-user
104+
${{ !matrix.debug && matrix.compiler == 'clang' && './configure --enable-optimizations' || '' }}
105+
${{ !matrix.debug && matrix.compiler == 'clang' && 'make profile-run-stamp --jobs 4' || '' }}
106+
export CC="${{ matrix.compiler == 'clang' && 'clang --target=$HOST' || '$HOST-gcc' }}"
107+
export CPP="$CC --preprocess"
108+
export HOSTRUNNER=qemu-${{ matrix.architecture }}
109+
export QEMU_LD_PREFIX="/usr/$HOST"
110+
./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
111+
make all --jobs 4
112+
./python -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3

.github/workflows/mypy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
- "Tools/build/generate_sbom.py"
1313
- "Tools/cases_generator/**"
1414
- "Tools/clinic/**"
15+
- "Tools/jit/**"
1516
- "Tools/peg_generator/**"
1617
- "Tools/requirements-dev.txt"
1718
- "Tools/wasm/**"
@@ -38,6 +39,7 @@ jobs:
3839
"Tools/build/",
3940
"Tools/cases_generator",
4041
"Tools/clinic",
42+
"Tools/jit",
4143
"Tools/peg_generator",
4244
"Tools/wasm",
4345
]

.github/workflows/reusable-windows.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Display build info
2121
run: .\python.bat -m test.pythoninfo
2222
- name: Tests
23-
run: .\PCbuild\rt.bat -p Win32 -d -q --fast-ci
23+
run: .\PCbuild\rt.bat -p Win32 -d -q --fast-ci ${{ inputs.free-threading && '--disable-gil' || '' }}
2424

2525
build_win_amd64:
2626
name: 'build and test (x64)'
@@ -37,7 +37,7 @@ jobs:
3737
- name: Display build info
3838
run: .\python.bat -m test.pythoninfo
3939
- name: Tests
40-
run: .\PCbuild\rt.bat -p x64 -d -q --fast-ci
40+
run: .\PCbuild\rt.bat -p x64 -d -q --fast-ci ${{ inputs.free-threading && '--disable-gil' || '' }}
4141

4242
build_win_arm64:
4343
name: 'build (arm64)'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ Tools/unicode/data/
126126
# hendrikmuhs/ccache-action@v1
127127
/.ccache
128128
/cross-build/
129+
/jit_stencils.h
129130
/platform
130131
/profile-clean-stamp
131132
/profile-run-stamp

Doc/c-api/complex.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,29 @@ Complex Numbers as Python Objects
117117
118118
Return the real part of *op* as a C :c:expr:`double`.
119119
120+
If *op* is not a Python complex number object but has a
121+
:meth:`~object.__complex__` method, this method will first be called to
122+
convert *op* to a Python complex number object. If :meth:`!__complex__` is
123+
not defined then it falls back to call :c:func:`PyFloat_AsDouble` and
124+
returns its result. Upon failure, this method returns ``-1.0``, so one
125+
should call :c:func:`PyErr_Occurred` to check for errors.
126+
127+
.. versionchanged:: 3.13
128+
Use :meth:`~object.__complex__` if available.
120129
121130
.. c:function:: double PyComplex_ImagAsDouble(PyObject *op)
122131
123132
Return the imaginary part of *op* as a C :c:expr:`double`.
124133
134+
If *op* is not a Python complex number object but has a
135+
:meth:`~object.__complex__` method, this method will first be called to
136+
convert *op* to a Python complex number object. If :meth:`!__complex__` is
137+
not defined then it falls back to call :c:func:`PyFloat_AsDouble` and
138+
returns ``0.0`` on success. Upon failure, this method returns ``-1.0``, so
139+
one should call :c:func:`PyErr_Occurred` to check for errors.
140+
141+
.. versionchanged:: 3.13
142+
Use :meth:`~object.__complex__` if available.
125143
126144
.. c:function:: Py_complex PyComplex_AsCComplex(PyObject *op)
127145

Doc/c-api/conversion.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,42 @@ The return value (*rv*) for these functions should be interpreted as follows:
4848
4949
The following functions provide locale-independent string to number conversions.
5050
51+
.. c:function:: unsigned long PyOS_strtoul(const char *str, char **ptr, int base)
52+
53+
Convert the initial part of the string in ``str`` to an :c:expr:`unsigned
54+
long` value according to the given ``base``, which must be between ``2`` and
55+
``36`` inclusive, or be the special value ``0``.
56+
57+
Leading white space and case of characters are ignored. If ``base`` is zero
58+
it looks for a leading ``0b``, ``0o`` or ``0x`` to tell which base. If
59+
these are absent it defaults to ``10``. Base must be 0 or between 2 and 36
60+
(inclusive). If ``ptr`` is non-``NULL`` it will contain a pointer to the
61+
end of the scan.
62+
63+
If the converted value falls out of range of corresponding return type,
64+
range error occurs (:c:data:`errno` is set to :c:macro:`!ERANGE`) and
65+
:c:macro:`!ULONG_MAX` is returned. If no conversion can be performed, ``0``
66+
is returned.
67+
68+
See also the Unix man page :manpage:`strtoul(3)`.
69+
70+
.. versionadded:: 3.2
71+
72+
73+
.. c:function:: long PyOS_strtol(const char *str, char **ptr, int base)
74+
75+
Convert the initial part of the string in ``str`` to an :c:expr:`long` value
76+
according to the given ``base``, which must be between ``2`` and ``36``
77+
inclusive, or be the special value ``0``.
78+
79+
Same as :c:func:`PyOS_strtoul`, but return a :c:expr:`long` value instead
80+
and :c:macro:`LONG_MAX` on overflows.
81+
82+
See also the Unix man page :manpage:`strtol(3)`.
83+
84+
.. versionadded:: 3.2
85+
86+
5187
.. c:function:: double PyOS_string_to_double(const char *s, char **endptr, PyObject *overflow_exception)
5288
5389
Convert a string ``s`` to a :c:expr:`double`, raising a Python

Doc/c-api/file.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,14 @@ the :mod:`io` APIs instead.
6565
Overrides the normal behavior of :func:`io.open_code` to pass its parameter
6666
through the provided handler.
6767
68-
The handler is a function of type :c:expr:`PyObject *(\*)(PyObject *path,
69-
void *userData)`, where *path* is guaranteed to be :c:type:`PyUnicodeObject`.
68+
The *handler* is a function of type:
69+
70+
.. c:namespace:: NULL
71+
.. c:type:: PyObject * (*Py_OpenCodeHookFunction)(PyObject *, void *)
72+
73+
Equivalent of :c:expr:`PyObject *(\*)(PyObject *path,
74+
void *userData)`, where *path* is guaranteed to be
75+
:c:type:`PyUnicodeObject`.
7076
7177
The *userData* pointer is passed into the hook function. Since hook
7278
functions may be called from different runtimes, this pointer should not

0 commit comments

Comments
 (0)