8000 Merge branch 'main' into fold-binop-cfg · python/cpython@cafbc61 · GitHub
[go: up one dir, main page]

Skip to content

Commit cafbc61

Browse files
authored
Merge branch 'main' into fold-binop-cfg
2 parents 2dba23f + 5d66c55 commit cafbc61

File tree

210 files changed

+7958
-5107
lines changed

Some content is hidden

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

210 files changed

+7958
-5107
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ Objects/exceptions.c @iritkatriel
106106

107107
# Hashing & cryptographic primitives
108108
**/*hashlib* @gpshead @tiran @picnixz
109+
**/*hashopenssl* @gpshead @tiran @picnixz
109110
**/*pyhash* @gpshead @tiran
110111
**/sha* @gpshead @tiran @picnixz
111112
Modules/md5* @gpshead @tiran @picnixz

.github/workflows/build.yml

Lines changed: 17 additions & 19 deletions
< 10000 /tr>
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ jobs:
6262
with:
6363
fetch-depth: 1
6464
persist-credentials: false
65-
- name: Runner image version
66-
run: echo "IMAGE_VERSION=${ImageVersion}" >> "$GITHUB_ENV"
6765
- name: Check Autoconf and aclocal versions
6866
run: |
6967
grep "Generated by GNU Autoconf 2.72" configure
@@ -104,14 +102,14 @@ jobs:
104102
with:
105103
python-version: '3.x'
106104
- name: Runner image version
107-
run: echo "IMAGE_VERSION=${ImageVersion}" >> "$GITHUB_ENV"
105+
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
108106
- name: Restore config.cache
109107
uses: actions/cache@v4
110108
with:
111109
path: config.cache
112110
# Include env.pythonLocation in key to avoid changes in environment when setup-python updates Python
113-
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.build-context.outputs.config-hash }}-${{ env.pythonLocation }}
114-
- name: Install Dependencies
111+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}-${{ env.pythonLocation }}
112+
- name: Install dependencies
115113
run: sudo ./.github/workflows/posix-deps-apt.sh
116114
- name: Add ccache to PATH
117115
run: echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
@@ -247,13 +245,13 @@ jobs:
247245
- true
248246
os:
249247
- ubuntu-24.04
250-
- ubuntu-22.04-arm
248+
- ubuntu-24.04-arm
251249
exclude:
252250
# Do not test BOLT with free-threading, to conserve resources
253251
- bolt: true
254252
free-threading: true
255253
# BOLT currently crashes during instrumentation on aarch64
256-
- os: ubuntu-22.04-arm
254+
- os: ubuntu-24.04-arm
257255
bolt: true
258256
uses: ./.github/workflows/reusable-ubuntu.yml
259257
with:
@@ -284,15 +282,15 @@ jobs:
284282
with:
285283
persist-credentials: false
286284
- name: Runner image version
287-
run: echo "IMAGE_VERSION=${ImageVersion}" >> "$GITHUB_ENV"
285+
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
288286
- name: Restore config.cache
289287
uses: actions/cache@v4
290288
with:
291289
path: config.cache
292-
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.build-context.outputs.config-hash }}
290+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}
293291
- name: Register gcc problem matcher
294292
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
295-
- name: Install Dependencies
293+
- name: Install dependencies
296294
run: sudo ./.github/workflows/posix-deps-apt.sh
297295
- name: Configure OpenSSL env vars
298296
run: |
@@ -347,7 +345,7 @@ jobs:
347345
persist-credentials: false
348346
- name: Register gcc problem matcher
349347
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
350-
- name: Install Dependencies
348+
- name: Install dependencies
351349
run: sudo ./.github/workflows/posix-deps-apt.sh
352350
- name: Configure OpenSSL env vars
353351
run: |
@@ -379,12 +377,12 @@ jobs:
379377
- name: Bind mount sources read-only
380378
run: sudo mount --bind -o ro "$GITHUB_WORKSPACE" "$CPYTHON_RO_SRCDIR"
381379
- name: Runner image version
382-
run: echo "IMAGE_VERSION=${ImageVersion}" >> "$GITHUB_ENV"
380+
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
383381
- name: Restore config.cache
384382
uses: actions/cache@v4
385383
with:
386384
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
387-
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.build-context.outputs.config-hash }}
385+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}
388386
- name: Configure CPython out-of-tree
389387
working-directory: ${{ env.CPYTHON_BUILDDIR }}
390388
run: |
@@ -466,15 +464,15 @@ jobs:
466464
with:
467465
persist-credentials: false
468466
- name: Runner image version
469-
run: echo "IMAGE_VERSION=${ImageVersion}" >> "$GITHUB_ENV"
467+
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
470468
- name: Restore config.cache
471469
uses: actions/cache@v4
472470
with:
473471
path: config.cache
474-
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.build-context.outputs.config-hash }}
472+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}
475473
- name: Register gcc problem matcher
476474
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
477-
- name: Install Dependencies
475+
- name: Install dependencies
478476
run: sudo ./.github/workflows/posix-deps-apt.sh
479477
- name: Set up GCC-10 for ASAN
480478
uses: egor-tensin/setup-gcc@v1
@@ -537,19 +535,19 @@ jobs:
537535
with:
538536
persist-credentials: false
539537
- name: Runner image version
540-
run: echo "IMAGE_VERSION=${ImageVersion}" >> "$GITHUB_ENV"
538+
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
541539
- name: Restore config.cache
542540
uses: actions/cache@v4
543541
with:
544542
path: config.cache
545-
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.build-context.outputs.config-hash }}
543+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}
546544
- name: Register gcc problem matcher
547545
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
548546
- name: Set build dir
549547
run:
550548
# an absolute path outside of the working directoy
551549
echo "BUILD_DIR=$(realpath ${{ github.workspace }}/../build)" >> "$GITHUB_ENV"
552-
- name: Install Dependencies
550+
- name: Install dependencies
553551
run: sudo ./.github/workflows/posix-deps-apt.sh
554552
- name: Configure host build
555553
run: ./configure --prefix="$BUILD_DIR/host-python"

.github/workflows/jit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
runner: ubuntu-24.04
8787
- target: aarch64-unknown-linux-gnu/gcc
8888
architecture: aarch64
89-
runner: ubuntu-22.04-arm
89+
runner: ubuntu-24.04-arm
9090
steps:
9191
- uses: actions/checkout@v4
9292
with:

.github/workflows/reusable-macos.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ jobs:
3535
with:
3636
persist-credentials: false
3737
- name: Runner image version
38-
run: echo "IMAGE_VERSION=${ImageVersion}" >> "$GITHUB_ENV"
38+
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
3939
- name: Restore config.cache
4040
uses: actions/cache@v4
4141
with:
4242
path: config.cache
43-
key: ${{ github.job }}-${{ inputs.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }}
43+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ inputs.config_hash }}
4444
- name: Install Homebrew dependencies
4545
run: |
4646
brew install pkg-config openssl@3.0 xz gdbm tcl-tk@8 make

.github/workflows/reusable-tsan.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ jobs:
2525
with:
2626
persist-credentials: false
2727
- name: Runner image version
28-
run: echo "IMAGE_VERSION=${ImageVersion}" >> "$GITHUB_ENV"
28+
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
2929
- name: Restore config.cache
3030
uses: actions/cache@v4
3131
with:
3232
path: config.cache
33-
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }}
34-
- name: Install Dependencies
33+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ inputs.config_hash }}
34+
- name: Install dependencies
3535
run: |
3636
sudo ./.github/workflows/posix-deps-apt.sh
3737
# Install clang-18
@@ -44,7 +44,7 @@ jobs:
4444
sudo update-alternatives --set clang++ /usr/bin/clang++-17
4545
# Reduce ASLR to avoid TSAN crashing
4646
sudo sysctl -w vm.mmap_rnd_bits=28
47-
- name: TSAN Option Setup
47+
- name: TSAN option setup
4848
run: |
4949
echo "TSAN_OPTIONS=log_path=${GITHUB_WORKSPACE}/tsan_log suppressions=${GITHUB_WORKSPACE}/Tools/tsan/suppressions${{
5050
fromJSON(inputs.free-threading)

.github/workflows/reusable-ubuntu.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ jobs:
7878
- name: Bind mount sources read-only
7979
run: sudo mount --bind -o ro "$GITHUB_WORKSPACE" "$CPYTHON_RO_SRCDIR"
8080
- name: Runner image version
81-
run: echo "IMAGE_VERSION=${ImageVersion}" >> "$GITHUB_ENV"
81+
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
8282
- name: Restore config.cache
8383
uses: actions/cache@v4
8484
with:
8585
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
86-
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ inputs. 10000 config_hash }}
86+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ inputs.config_hash }}
8787
- name: Configure CPython out-of-tree
8888
working-directory: ${{ env.CPYTHON_BUILDDIR }}
8989
# `test_unpickle_module_race` writes to the source directory, which is

.github/workflows/reusable-wasi.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,16 @@ jobs:
5353
uses: actions/setup-python@v5
5454
with:
5555
python-version: '3.x'
56+
- name: "Runner image version"
57+
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
5658
- name: "Restore Python build config.cache"
5759
uses: actions/cache@v4
5860
with:
5961
path: ${{ env.CROSS_BUILD_PYTHON }}/config.cache
6062
# Include env.pythonLocation in key to avoid changes in environment when setup-python updates Python.
6163
# Include the hash of `Tools/wasm/wasi.py` as it may change the environment variables.
6264
# (Make sure to keep the key in sync with the other config.cache step below.)
63-
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_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.py') }}-${{ env.pythonLocation }}
6466
- name: "Configure build Python"
6567
run: python3 Tools/wasm/wasi.py configure-build-python -- --config-cache --with-pydebug
6668
- name: "Make build Python"
@@ -70,7 +72,7 @@ jobs:
7072
with:
7173
path: ${{ env.CROSS_BUILD_WASI }}/config.cache
7274
# Should be kept in sync with the other config.cache step above.
73-
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_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.py') }}-${{ env.pythonLocation }}
7476
- name: "Configure host"
7577
# `--with-pydebug` inferred from configure-build-python
7678
run: python3 Tools/wasm/wasi.py configure-host -- --config-cache

.github/workflows/tail-call.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
runner: ubuntu-24.04
6666
- target: aarch64-unknown-linux-gnu/gcc
6767
architecture: aarch64
68-
runner: ubuntu-22.04-arm
68+
runner: ubuntu-24.04-arm
6969
- target: free-threading
7070
architecture: x86_64
7171
runner: ubuntu-24.04

Android/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ stderr. Add the `-v` option to also show Gradle output, and non-Python logcat
119119
messages.
120120

121121
Any other arguments on the `android.py test` command line will be passed through
122-
to `python -m test` use `--` to separate them from android.py's own options.
122+
to `python -m test` use `--` to separate them from android.py's own options.
123123
See the [Python Developer's
124124
Guide](https://devguide.python.org/testing/run-write-tests/) for common options
125-
 most of them will work on Android, except for those that involve subprocesses,
125+
most of them will work on Android, except for those that involve subprocesses,
126126
such as `-j`.
127127

128128
Every time you run `android.py test`, changes in pure-Python files in the

Doc/c-api/arg.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,10 @@ Building values
645645
``n`` (:class:`int`) [:c:type:`Py_ssize_t`]
646646
Convert a C :c:type:`Py_ssize_t` to a Python integer.
647647
648+
``p`` (:class:`bool`) [int]
649+
Convert a C :c:expr:`int` to a Python :class:`bool` object.
650+
.. versionadded:: 3.14
651+
648652
``c`` (:class:`bytes` of length 1) [char]
649653
Convert a C :c:expr:`int` representing a byte to a Python :class:`bytes` object of
650654
length 1.

Doc/c-api/exceptions.rst

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -921,11 +921,7 @@ because the :ref:`call protocol <call>` takes care of recursion handling.
921921
922922
Marks a point where a recursive C-level call is about to be performed.
923923
924-
If :c:macro:`!USE_STACKCHECK` is defined, this function checks if the OS
925-
stack overflowed using :c:func:`PyOS_CheckStack`. If this is the case, it
926-
sets a :exc:`MemoryError` and returns a nonzero value.
927-
928-
The function then checks if the recursion limit is reached. If this is the
924+
The function then checks if the stack limit is reached. If this is the
929925
case, a :exc:`RecursionError` is set and a nonzero value is returned.
930926
Otherwise, zero is returned.
931927

Doc/c-api/function.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,13 @@ There are a few functions specific to Python functions.
145145
146146
.. c:type:: PyFunction_WatchEvent
147147
148-
Enumeration of possible function watcher events:
149-
- ``PyFunction_EVENT_CREATE``
150-
- ``PyFunction_EVENT_DESTROY``
151-
- ``PyFunction_EVENT_MODIFY_CODE``
152-
- ``PyFunction_EVENT_MODIFY_DEFAULTS``
153-
- ``PyFunction_EVENT_MODIFY_KWDEFAULTS``
148+
Enumeration of possible function watcher events:
149+
150+
- ``PyFunction_EVENT_CREATE``
151+
- ``PyFunction_EVENT_DESTROY``
152+
- ``PyFunction_EVENT_MODIFY_CODE``
153+
- ``PyFunction_EVENT_MODIFY_DEFAULTS``
154+
- ``PyFunction_EVENT_MODIFY_KWDEFAULTS``
154155
155156
.. versionadded:: 3.12
156157

Doc/c-api/slice.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ Ellipsis Object
118118
^^^^^^^^^^^^^^^
119119
120120
121+
.. c:var:: PyTypeObject PyEllipsis_Type
122+
123+
The type of Python :const:`Ellipsis` object. Same as :class:`types.EllipsisType`
124+
in the Python layer.
125+
126+
121127
.. c:var:: PyObject *Py_Ellipsis
122128
123129
The Python ``Ellipsis`` object. This object has no methods. Like

Doc/c-api/unicode.rst

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,6 +1398,20 @@ They all return ``NULL`` or ``-1`` if an exception occurs.
13981398
separator. At most *maxsplit* splits will be done. If negative, no limit is
13991399
set. Separators are not included in the resulting list.
14001400
1401+
On error, return ``NULL`` with an exception set.
1402+
1403+
Equivalent to :py:meth:`str.split`.
1404+
1405+
1406+
.. c:function:: PyObject* PyUnicode_RSplit(PyObject *unicode, PyObject *sep, Py_ssize_t maxsplit)
1407+
1408+
Similar to :c:func:`PyUnicode_Split`, but splitting will be done beginning
1409+
at the end of the string.
1410+
1411+
On error, return ``NULL`` with an exception set.
1412+
1413+
Equivalent to :py:meth:`str.rsplit`.
1414+
14011415
14021416
.. c:function:: PyObject* PyUnicode_Splitlines(PyObject *unicode, int keepends)
14031417
@@ -1406,6 +1420,33 @@ They all return ``NULL`` or ``-1`` if an exception occurs.
14061420
characters are not included in the resulting strings.
14071421
14081422
1423+
.. c:function:: PyObject* PyUnicode_Partition(PyObject *unicode, PyObject *sep)
1424+
1425+
Split a Unicode string at the first occurrence of *sep*, and return
1426+
a 3-tuple containing the part before the separator, the separator itself,
1427+
and the part after the separator. If the separator is not found,
1428+
return a 3-tuple containing the string itself, followed by two empty strings.
1429+
1430+
*sep* must not be empty.
1431+
1432+
On error, return ``NULL`` with an exception set.
1433+
1434+
Equivalent to :py:meth:`str.partition`.
1435+
1436+
1437+
.. c:function:: PyObject* PyUnicode_RPartition(PyObject *unicode, PyObject *sep)
1438+
1439+
Similar to :c:func:`PyUnicode_Partition`, but split a Unicode string at the
1440+
last occurrence of *sep*. If the separator is not found, return a 3-tuple
1441+
containing two empty strings, followed by the string itself.
1442+
1443+
*sep* must not be empty.
1444+
1445+
On error, return ``NULL`` with an exception set.
1446+
1447+
Equivalent to :py:meth:`str.rpartition`.
1448+
1449+
14091450
.. c:function:: PyObject* PyUnicode_Join(PyObject *separator, PyObject *seq)
14101451
14111452
Join a sequence of strings using the given *separator* and return the resulting

Doc/data/refcounts.dat

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2655,13 +2655,26 @@ PyUnicode_Concat:PyObject*::+1:
26552655
PyUnicode_Concat:PyObject*:left:0:
26562656
PyUnicode_Concat:PyObject*:right:0:
26572657

2658+
PyUnicode_Partition:PyObject*::+1:
2659+
PyUnicode_Partition:PyObject*:unicode:0:
2660+
PyUnicode_Partition:PyObject*:sep:0:
2661+
2662+
PyUnicode_RPartition:PyObject*::+1:
2663+
PyUnicode_RPartition:PyObject*:unicode:0:
2664+
PyUnicode_RPartition:PyObject*:sep:0:
2665+
2666+
PyUnicode_RSplit:PyObject*::+1:
2667+
PyUnicode_RSplit:PyObject*:unicode:0:
2668+
PyUnicode_RSplit:PyObject*:sep:0:
2669+
PyUnicode_RSplit:Py_ssize_t:maxsplit::
2670+
26582671
PyUnicode_Split:PyObject*::+1:
2659-
PyUnicode_Split:PyObject*:left:0:
2660-
PyUnicode_Split:PyObject*:right:0:
2672+
PyUnicode_Split:PyObject*:unicode:0:
2673+
PyUnicode_Split:PyObject*:sep:0:
26612674
PyUnicode_Split:Py_ssize_t:maxsplit::
26622675

26632676
PyUnicode_Splitlines:PyObject*::+1:
2664-
PyUnicode_Splitlines:PyObject*:s:0:
2677+
PyUnicode_Splitlines:PyObject*:unicode:0:
26652678
PyUnicode_Splitlines:int:keepend::
26662679

26672680
PyUnicode_Translate:PyObject*::+1:

0 commit comments

Comments
 (0)
0