Skip to content

Commit 4768a38

Browse files
committed
Merge branch 'main' into use-stackrefs
2 parents 497fb9f + fcbe6ec commit 4768a38

File tree

60 files changed

+1217
-728
lines changed

Some content is hidden

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

60 files changed

+1217
-728
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,19 @@ jobs:
235235
free-threading:
236236
- false
237237
- true
238+
os:
239+
- ubuntu-24.04
240+
- ubuntu-24.04-aarch64
241+
is-fork: # only used for the exclusion trick
242+
- ${{ github.repository_owner != 'python' }}
243+
exclude:
244+
- os: ubuntu-24.04-aarch64
245+
is-fork: true
238246
uses: ./.github/workflows/reusable-ubuntu.yml
239247
with:
240248
config_hash: ${{ needs.check_source.outputs.config_hash }}
241249
free-threading: ${{ matrix.free-threading }}
250+
os: ${{ matrix.os }}
242251

243252
build_ubuntu_ssltests:
244253
name: 'Ubuntu SSL tests with OpenSSL'

.github/workflows/jit.yml

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ concurrency:
2828
jobs:
2929
interpreter:
3030
name: Interpreter (Debug)
31-
runs-on: ubuntu-22.04
31+
runs-on: ubuntu-24.04
3232
timeout-minutes: 90
3333
steps:
3434
- uses: actions/checkout@v4
@@ -78,10 +78,11 @@ jobs:
7878
runner: macos-14
7979
- target: x86_64-unknown-linux-gnu/gcc
8080
architecture: x86_64
81-
runner: ubuntu-22.04
81+
runner: ubuntu-24.04
8282
- target: aarch64-unknown-linux-gnu/gcc
8383
architecture: aarch64
84-
runner: ubuntu-22.04
84+
# Forks don't have access to our paid AArch64 runners. These jobs are skipped below:
85+
runner: ${{ github.repository_owner == 'python' && 'ubuntu-24.04-aarch64' || 'ubuntu-24.04' }}
8586
steps:
8687
- uses: actions/checkout@v4
8788
- uses: actions/setup-python@v5
@@ -118,37 +119,19 @@ jobs:
118119
./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
119120
120121
- name: Native Linux
121-
if: runner.os == 'Linux' && matrix.architecture == 'x86_64'
122+
# Forks don't have access to our paid AArch64 runners. Skip those:
123+
if: runner.os == 'Linux' && (matrix.architecture == 'x86_64' || github.repository_owner == 'python')
122124
run: |
123125
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
124126
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
125127
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '' }}
126128
make all --jobs 4
127129
./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
128130
129-
- name: Emulated Linux
130-
if: runner.os == 'Linux' && matrix.architecture != 'x86_64'
131-
# The --ignorefile on ./python -m test is used to exclude tests known to fail when running on an emulated Linux.
132-
run: |
133-
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
134-
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
135-
./configure --prefix="$(pwd)/../build"
136-
make install --jobs 4
137-
make clean --jobs 4
138-
export HOST=${{ matrix.architecture }}-linux-gnu
139-
sudo apt install --yes "gcc-$HOST" qemu-user
140-
export QEMU_LD_PREFIX="/usr/$HOST"
141-
CC="$HOST-gcc" \
142-
CPP="$HOST-gcc --preprocess" \
143-
HOSTRUNNER=qemu-${{ matrix.architecture }} \
144-
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '' }} --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
145-
make all --jobs 4
146-
./python -m test --ignorefile=Tools/jit/ignore-tests-emulated-linux.txt --multiprocess 0 --timeout 4500 --verbose2 --verbose3
147-
148131
jit-with-disabled-gil:
149132
name: Free-Threaded (Debug)
150133
needs: interpreter
151-
runs-on: ubuntu-22.04
134+
runs-on: ubuntu-24.04
152135
strategy:
153136
matrix:
154137
llvm:

.github/workflows/reusable-ubuntu.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ on:
1111
required: false
1212
type: boolean
1313
default: false
14+
os:
15+
description: OS to run the job
16+
required: true
17+
type: string
1418

1519
jobs:
1620
build_ubuntu_reusable:
17-
name: 'build and test'
21+
name: build and test (${{ inputs.os }})
1822
timeout-minutes: 60
19-
runs-on: ${{ matrix.os }}
20-
strategy:
21-
fail-fast: false
22-
matrix:
23-
os: [ubuntu-24.04, ubuntu-24.04-aarch64]
23+
runs-on: ${{ inputs.os }}
2424
env:
2525
FORCE_COLOR: 1
2626
OPENSSL_VER: 3.0.15
@@ -42,7 +42,7 @@ jobs:
4242
uses: actions/cache@v4
4343
with:
4444
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
45-
key: ${{ matrix.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
45+
key: ${{ inputs.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
4646
- name: Install OpenSSL
4747
if: steps.cache-openssl.outputs.cache-hit != 'true'
4848
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory "$MULTISSL_DIR" --openssl "$OPENSSL_VER" --system Linux
@@ -84,7 +84,7 @@ jobs:
8484
working-directory: ${{ env.CPYTHON_BUILDDIR }}
8585
run: make -j
8686
- name: Build CPython out-of-tree (for compiler warning check)
87-
if: ${{ !inputs.free-threading}}
87+
if: ${{ !inputs.free-threading }}
8888
working-directory: ${{ env.CPYTHON_BUILDDIR }}
8989
run: set -o pipefail; make -j --output-sync 2>&1 | tee compiler_output_ubuntu.txt
9090
- name: Display build info

Doc/c-api/exceptions.rst

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -853,12 +853,23 @@ The following functions are used to create and modify Unicode exceptions from C.
853853
*\*start*. *start* must not be ``NULL``. Return ``0`` on success, ``-1`` on
854854
failure.
855855
856+
If the :attr:`UnicodeError.object` is an empty sequence, the resulting
857+
*start* is ``0``. Otherwise, it is clipped to ``[0, len(object) - 1]``.
858+
859+
.. seealso:: :attr:`UnicodeError.start`
860+
856861
.. c:function:: int PyUnicodeDecodeError_SetStart(PyObject *exc, Py_ssize_t start)
857862
int PyUnicodeEncodeError_SetStart(PyObject *exc, Py_ssize_t start)
858863
int PyUnicodeTranslateError_SetStart(PyObject *exc, Py_ssize_t start)
859864
860-
Set the *start* attribute of the given exception object to *start*. Return
861-
``0`` on success, ``-1`` on failure.
865+
Set the *start* attribute of the given exception object to *start*.
866+
Return ``0`` on success, ``-1`` on failure.
867+
868+
.. note::
869+
870+
While passing a negative *start* does not raise an exception,
871+
the corresponding getters will not consider it as a relative
872+
offset.
862873
863874
.. c:function:: int PyUnicodeDecodeError_GetEnd(PyObject *exc, Py_ssize_t *end)
864875
int PyUnicodeEncodeError_GetEnd(PyObject *exc, Py_ssize_t *end)
@@ -868,13 +879,18 @@ The following functions are used to create and modify Unicode exceptions from C.
868879
*\*end*. *end* must not be ``NULL``. Return ``0`` on success, ``-1`` on
869880
failure.
870881
882+
If the :attr:`UnicodeError.object` is an empty sequence, the resulting
883+
*end* is ``0``. Otherwise, it is clipped to ``[1, len(object)]``.
884+
871885
.. c:function:: int PyUnicodeDecodeError_SetEnd(PyObject *exc, Py_ssize_t end)
872886
int PyUnicodeEncodeError_SetEnd(PyObject *exc, Py_ssize_t end)
873887
int PyUnicodeTranslateError_SetEnd(PyObject *exc, Py_ssize_t end)
874888
875889
Set the *end* attribute of the given exception object to *end*. Return ``0``
876890
on success, ``-1`` on failure.
877891
892+
.. seealso:: :attr:`UnicodeError.end`
893+
878894
.. c:function:: PyObject* PyUnicodeDecodeError_GetReason(PyObject *exc)
879895
PyObject* PyUnicodeEncodeError_GetReason(PyObject *exc)
880896
PyObject* PyUnicodeTranslateError_GetReason(PyObject *exc)

Doc/c-api/unicode.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,6 +1588,11 @@ object.
15881588
15891589
Create a Unicode writer instance.
15901590
1591+
*length* must be greater than or equal to ``0``.
1592+
1593+
If *length* is greater than ``0``, preallocate an internal buffer of
1594+
*length* characters.
1595+
15911596
Set an exception and return ``NULL`` on error.
15921597
15931598
.. c:function:: PyObject* PyUnicodeWriter_Finish(PyUnicodeWriter *writer)
@@ -1596,12 +1601,16 @@ object.
15961601
15971602
Set an exception and return ``NULL`` on error.
15981603
1604+
The writer instance is invalid after this call.
1605+
15991606
.. c:function:: void PyUnicodeWriter_Discard(PyUnicodeWriter *writer)
16001607
16011608
Discard the internal Unicode buffer and destroy the writer instance.
16021609
16031610
If *writer* is ``NULL``, no operation is performed.
16041611
1612+
The writer instance is invalid after this call.
1613+
16051614
.. c:function:: int PyUnicodeWriter_WriteChar(PyUnicodeWriter *writer, Py_UCS4 ch)
16061615
16071616
Write the single Unicode character *ch* into *writer*.

Doc/library/exceptions.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,10 +644,16 @@ The following exceptions are the exceptions that are usually raised.
644644

645645
The first index of invalid data in :attr:`object`.
646646

647+
This value should not be negative as it is interpreted as an
648+
absolute offset but this constraint is not enforced at runtime.
649+
647650
.. attribute:: end
648651

649652
The index after the last invalid data in :attr:`object`.
650653

654+
This value should not be negative as it is interpreted as an
655+
absolute offset but this constraint is not enforced at runtime.
656+
651657

652658
.. exception:: UnicodeEncodeError
653659

Doc/library/select.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,17 @@ Edge and Level Trigger Polling (epoll) Objects
317317
+-------------------------+-----------------------------------------------+
318318
| :const:`EPOLLMSG` | Ignored. |
319319
+-------------------------+-----------------------------------------------+
320+
| :const:`EPOLLWAKEUP` | Prevents sleep during event waiting. |
321+
+-------------------------+-----------------------------------------------+
320322

321323
.. versionadded:: 3.6
322324
:const:`EPOLLEXCLUSIVE` was added. It's only supported by Linux Kernel 4.5
323325
or later.
324326

327+
.. versionadded:: next
328+
:const:`EPOLLWAKEUP` was added. It's only supported by Linux Kernel 3.5
329+
or later.
330+
325331
.. method:: epoll.close()
326332

327333
Close the control file descriptor of the epoll object.

Include/internal/pycore_backoff.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,9 @@ initial_jump_backoff_counter(void)
115115
/* Initial exit temperature.
116116
* Must be larger than ADAPTIVE_COOLDOWN_VALUE,
117117
* otherwise when a side exit warms up we may construct
118-
* a new trace before the Tier 1 code has properly re-specialized.
119-
* Backoff sequence 64, 128, 256, 512, 1024, 2048, 4096. */
120-
#define SIDE_EXIT_INITIAL_VALUE 63
121-
#define SIDE_EXIT_INITIAL_BACKOFF 6
118+
* a new trace before the Tier 1 code has properly re-specialized. */
119+
#define SIDE_EXIT_INITIAL_VALUE 4095
120+
#define SIDE_EXIT_INITIAL_BACKOFF 12
122121

123122
static inline _Py_BackoffCounter
124123
initial_temperature_backoff_counter(void)

Lib/_strptime.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,6 @@ def __init__(self, locale_time=None):
301301
'V': r"(?P<V>5[0-3]|0[1-9]|[1-4]\d|\d)",
302302
# W is set below by using 'U'
303303
'y': r"(?P<y>\d\d)",
304-
#XXX: Does 'Y' need to worry about having less or more than
305-
# 4 digits?
306304
'Y': r"(?P<Y>\d\d\d\d)",
307305
'z': r"(?P<z>[+-]\d\d:?[0-5]\d(:?[0-5]\d(\.\d{1,6})?)?|(?-i:Z))",
308306
'A': self.__seqToRE(self.locale_time.f_weekday, 'A'),

Lib/test/list_tests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from functools import cmp_to_key
77

88
from test import seq_tests
9-
from test.support import ALWAYS_EQ, NEVER_EQ, get_c_recursion_limit
9+
from test.support import ALWAYS_EQ, NEVER_EQ, get_c_recursion_limit, skip_emscripten_stack_overflow
1010

1111

1212
class CommonTest(seq_tests.CommonTest):
@@ -59,6 +59,7 @@ def test_repr(self):
5959
self.assertEqual(str(a2), "[0, 1, 2, [...], 3]")
6060
self.assertEqual(repr(a2), "[0, 1, 2, [...], 3]")
6161

62+
@skip_emscripten_stack_overflow()
6263
def test_repr_deep(self):
6364
a = self.type2test([])
6465
for i in range(get_c_recursion_limit() + 1):

0 commit comments

Comments
 (0)