Skip to content

Commit

Permalink
Merge branch 'main' into methodcaller_ft_v2
Browse files Browse the repository at this point in the history
  • Loading branch information
eendebakpt authored Dec 8, 2024
2 parents a130d69 + a03efb5 commit e636dc8
Show file tree
Hide file tree
Showing 226 changed files with 5,639 additions and 2,783 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jobs:
- name: Build CPython
run: |
make -j4 regen-all
make regen-stdlib-module-names regen-sbom
make regen-stdlib-module-names regen-sbom regen-unicodedata
- name: Check for changes
run: |
git add -u
Expand Down Expand Up @@ -235,10 +235,19 @@ jobs:
free-threading:
- false
- true
os:
- ubuntu-24.04
- ubuntu-24.04-aarch64
is-fork: # only used for the exclusion trick
- ${{ github.repository_owner != 'python' }}
exclude:
- os: ubuntu-24.04-aarch64
is-fork: true
uses: ./.github/workflows/reusable-ubuntu.yml
with:
config_hash: ${{ needs.check_source.outputs.config_hash }}
free-threading: ${{ matrix.free-threading }}
os: ${{ matrix.os }}

build_ubuntu_ssltests:
name: 'Ubuntu SSL tests with OpenSSL'
Expand Down
33 changes: 8 additions & 25 deletions .github/workflows/jit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ concurrency:
jobs:
interpreter:
name: Interpreter (Debug)
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -78,10 +78,11 @@ jobs:
runner: macos-14
- target: x86_64-unknown-linux-gnu/gcc
architecture: x86_64
runner: ubuntu-22.04
runner: ubuntu-24.04
- target: aarch64-unknown-linux-gnu/gcc
architecture: aarch64
runner: ubuntu-22.04
# Forks don't have access to our paid AArch64 runners. These jobs are skipped below:
runner: ${{ github.repository_owner == 'python' && 'ubuntu-24.04-aarch64' || 'ubuntu-24.04' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -104,7 +105,7 @@ jobs:
# The `find` line is required as a result of https://github.com/actions/runner-images/issues/9966.
# This is a bug in the macOS runner image where the pre-installed Python is installed in the same
# directory as the Homebrew Python, which causes the build to fail for macos-13. This line removes
# directory as the Homebrew Python, which causes the build to fail for macos-13. This line removes
# the symlink to the pre-installed Python so that the Homebrew Python is used instead.
- name: Native macOS
if: runner.os == 'macOS'
Expand All @@ -118,37 +119,19 @@ jobs:
./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
- name: Native Linux
if: runner.os == 'Linux' && matrix.architecture == 'x86_64'
# Forks don't have access to our paid AArch64 runners. Skip those:
if: runner.os == 'Linux' && (matrix.architecture == 'x86_64' || github.repository_owner == 'python')
run: |
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '' }}
make all --jobs 4
./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
- name: Emulated Linux
if: runner.os == 'Linux' && matrix.architecture != 'x86_64'
# The --ignorefile on ./python -m test is used to exclude tests known to fail when running on an emulated Linux.
run: |
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
./configure --prefix="$(pwd)/../build"
make install --jobs 4
make clean --jobs 4
export HOST=${{ matrix.architecture }}-linux-gnu
sudo apt install --yes "gcc-$HOST" qemu-user
export QEMU_LD_PREFIX="/usr/$HOST"
CC="$HOST-gcc" \
CPP="$HOST-gcc --preprocess" \
HOSTRUNNER=qemu-${{ matrix.architecture }} \
./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
make all --jobs 4
./python -m test --ignorefile=Tools/jit/ignore-tests-emulated-linux.txt --multiprocess 0 --timeout 4500 --verbose2 --verbose3
jit-with-disabled-gil:
name: Free-Threaded (Debug)
needs: interpreter
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
matrix:
llvm:
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/reusable-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ on:
required: false
type: boolean
default: false
os:
description: OS to run the job
required: true
type: string

jobs:
build_ubuntu_reusable:
name: 'build and test'
name: build and test (${{ inputs.os }})
timeout-minutes: 60
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, ubuntu-24.04-aarch64]
runs-on: ${{ inputs.os }}
env:
FORCE_COLOR: 1
OPENSSL_VER: 3.0.15
Expand All @@ -42,7 +42,7 @@ jobs:
uses: actions/cache@v4
with:
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
key: ${{ matrix.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
key: ${{ inputs.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
- name: Install OpenSSL
if: steps.cache-openssl.outputs.cache-hit != 'true'
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory "$MULTISSL_DIR" --openssl "$OPENSSL_VER" --system Linux
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
working-directory: ${{ env.CPYTHON_BUILDDIR }}
run: make -j
- name: Build CPython out-of-tree (for compiler warning check)
if: ${{ !inputs.free-threading}}
if: ${{ !inputs.free-threading }}
working-directory: ${{ env.CPYTHON_BUILDDIR }}
run: set -o pipefail; make -j --output-sync 2>&1 | tee compiler_output_ubuntu.txt
- name: Display build info
Expand Down
20 changes: 18 additions & 2 deletions Doc/c-api/exceptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -853,12 +853,23 @@ The following functions are used to create and modify Unicode exceptions from C.
*\*start*. *start* must not be ``NULL``. Return ``0`` on success, ``-1`` on
failure.
If the :attr:`UnicodeError.object` is an empty sequence, the resulting
*start* is ``0``. Otherwise, it is clipped to ``[0, len(object) - 1]``.
.. seealso:: :attr:`UnicodeError.start`
.. c:function:: int PyUnicodeDecodeError_SetStart(PyObject *exc, Py_ssize_t start)
int PyUnicodeEncodeError_SetStart(PyObject *exc, Py_ssize_t start)
int PyUnicodeTranslateError_SetStart(PyObject *exc, Py_ssize_t start)
Set the *start* attribute of the given exception object to *start*. Return
``0`` on success, ``-1`` on failure.
Set the *start* attribute of the given exception object to *start*.
Return ``0`` on success, ``-1`` on failure.
.. note::
While passing a negative *start* does not raise an exception,
the corresponding getters will not consider it as a relative
offset.
.. c:function:: int PyUnicodeDecodeError_GetEnd(PyObject *exc, Py_ssize_t *end)
int PyUnicodeEncodeError_GetEnd(PyObject *exc, Py_ssize_t *end)
Expand All @@ -868,13 +879,18 @@ The following functions are used to create and modify Unicode exceptions from C.
*\*end*. *end* must not be ``NULL``. Return ``0`` on success, ``-1`` on
failure.
If the :attr:`UnicodeError.object` is an empty sequence, the resulting
*end* is ``0``. Otherwise, it is clipped to ``[1, len(object)]``.
.. c:function:: int PyUnicodeDecodeError_SetEnd(PyObject *exc, Py_ssize_t end)
int PyUnicodeEncodeError_SetEnd(PyObject *exc, Py_ssize_t end)
int PyUnicodeTranslateError_SetEnd(PyObject *exc, Py_ssize_t end)
Set the *end* attribute of the given exception object to *end*. Return ``0``
on success, ``-1`` on failure.
.. seealso:: :attr:`UnicodeError.end`
.. c:function:: PyObject* PyUnicodeDecodeError_GetReason(PyObject *exc)
PyObject* PyUnicodeEncodeError_GetReason(PyObject *exc)
PyObject* PyUnicodeTranslateError_GetReason(PyObject *exc)
Expand Down
14 changes: 11 additions & 3 deletions Doc/c-api/stable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Limited C API

Python 3.2 introduced the *Limited API*, a subset of Python's C API.
Extensions that only use the Limited API can be
compiled once and work with multiple versions of Python.
compiled once and be loaded on multiple versions of Python.
Contents of the Limited API are :ref:`listed below <limited-api-list>`.

.. c:macro:: Py_LIMITED_API
Expand All @@ -76,7 +76,7 @@ Contents of the Limited API are :ref:`listed below <limited-api-list>`.

Define ``Py_LIMITED_API`` to the value of :c:macro:`PY_VERSION_HEX`
corresponding to the lowest Python version your extension supports.
The extension will work without recompilation with all Python 3 releases
The extension will be ABI-compatible with all Python 3 releases
from the specified one onward, and can use Limited API introduced up to that
version.

Expand All @@ -94,7 +94,15 @@ Stable ABI
----------

To enable this, Python provides a *Stable ABI*: a set of symbols that will
remain compatible across Python 3.x versions.
remain ABI-compatible across Python 3.x versions.

.. note::

The Stable ABI prevents ABI issues, like linker errors due to missing
symbols or data corruption due to changes in structure layouts or function
signatures.
However, other changes in Python can change the *behavior* of extensions.
See Python's Backwards Compatibility Policy (:pep:`387`) for details.

The Stable ABI contains symbols exposed in the :ref:`Limited API
<limited-c-api>`, but also other ones – for example, functions necessary to
Expand Down
9 changes: 9 additions & 0 deletions Doc/c-api/unicode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1588,6 +1588,11 @@ object.
Create a Unicode writer instance.
*length* must be greater than or equal to ``0``.
If *length* is greater than ``0``, preallocate an internal buffer of
*length* characters.
Set an exception and return ``NULL`` on error.
.. c:function:: PyObject* PyUnicodeWriter_Finish(PyUnicodeWriter *writer)
Expand All @@ -1596,12 +1601,16 @@ object.
Set an exception and return ``NULL`` on error.
The writer instance is invalid after this call.
.. c:function:: void PyUnicodeWriter_Discard(PyUnicodeWriter *writer)
Discard the internal Unicode buffer and destroy the writer instance.
If *writer* is ``NULL``, no operation is performed.
The writer instance is invalid after this call.
.. c:function:: int PyUnicodeWriter_WriteChar(PyUnicodeWriter *writer, Py_UCS4 ch)
Write the single Unicode character *ch* into *writer*.
Expand Down
7 changes: 7 additions & 0 deletions Doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@
.. |python_version_literal| replace:: ``Python {version}``
.. |python_x_dot_y_literal| replace:: ``python{version}``
.. |usr_local_bin_python_x_dot_y_literal| replace:: ``/usr/local/bin/python{version}``
.. Apparently this how you hack together a formatted link:
(https://www.docutils.org/docs/ref/rst/directives.html#replacement-text)
.. |FORCE_COLOR| replace:: ``FORCE_COLOR``
.. _FORCE_COLOR: https://force-color.org/
.. |NO_COLOR| replace:: ``NO_COLOR``
.. _NO_COLOR: https://no-color.org/
"""

# There are two options for replacing |today|. Either, you set today to some
Expand Down
40 changes: 21 additions & 19 deletions Doc/data/refcounts.dat
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ PyCapsule_IsValid:const char*:name::
PyCapsule_New:PyObject*::+1:
PyCapsule_New:void*:pointer::
PyCapsule_New:const char *:name::
PyCapsule_New::void (* destructor)(PyObject* )::
PyCapsule_New:void (*)(PyObject *):destructor::

PyCapsule_SetContext:int:::
PyCapsule_SetContext:PyObject*:self:0:
Expand Down Expand Up @@ -349,11 +349,11 @@ PyComplex_CheckExact:int:::
PyComplex_CheckExact:PyObject*:p:0:

PyComplex_FromCComplex:PyObject*::+1:
PyComplex_FromCComplex::Py_complex v::
PyComplex_FromCComplex:Py_complex:v::

PyComplex_FromDoubles:PyObject*::+1:
PyComplex_FromDoubles::double real::
PyComplex_FromDoubles::double imag::
PyComplex_FromDoubles:double:real::
PyComplex_FromDoubles:double:imag::

PyComplex_ImagAsDouble:double:::
PyComplex_ImagAsDouble:PyObject*:op:0:
Expand Down Expand Up @@ -620,7 +620,9 @@ PyErr_GetExcInfo:PyObject**:pvalue:+1:
PyErr_GetExcInfo:PyObject**:ptraceback:+1:

PyErr_GetRaisedException:PyObject*::+1:
PyErr_SetRaisedException::::

PyErr_SetRaisedException:void:::
PyErr_SetRaisedException:PyObject *:exc:0:stolen

PyErr_GivenExceptionMatches:int:::
PyErr_GivenExceptionMatches:PyObject*:given:0:
Expand All @@ -640,9 +642,9 @@ PyErr_NewExceptionWithDoc:PyObject*:dict:0:
PyErr_NoMemory:PyObject*::null:

PyErr_NormalizeException:void:::
PyErr_NormalizeException:PyObject**:exc::???
PyErr_NormalizeException:PyObject**:val::???
PyErr_NormalizeException:PyObject**:tb::???
PyErr_NormalizeException:PyObject**:exc:+1:???
PyErr_NormalizeException:PyObject**:val:+1:???
PyErr_NormalizeException:PyObject**:tb:+1:???

PyErr_Occurred:PyObject*::0:

Expand Down Expand Up @@ -1314,7 +1316,7 @@ PyMapping_GetItemString:const char*:key::

PyMapping_HasKey:int:::
PyMapping_HasKey:PyObject*:o:0:
PyMapping_HasKey:PyObject*:key::
PyMapping_HasKey:PyObject*:key:0:

PyMapping_HasKeyString:int:::
PyMapping_HasKeyString:PyObject*:o:0:
Expand Down Expand Up @@ -1474,7 +1476,7 @@ PyModule_GetState:void*:::
PyModule_GetState:PyObject*:module:0:

PyModule_New:PyObject*::+1:
PyModule_New::char* name::
PyModule_New:char*:name::

PyModule_NewObject:PyObject*::+1:
PyModule_NewObject:PyObject*:name:+1:
Expand All @@ -1484,7 +1486,7 @@ PyModule_SetDocString:PyObject*:module:0:
PyModule_SetDocString:const char*:docstring::

PyModuleDef_Init:PyObject*::0:
PyModuleDef_Init:PyModuleDef*:def:0:
PyModuleDef_Init:PyModuleDef*:def::

PyNumber_Absolute:PyObject*::+1:
PyNumber_Absolute:PyObject*:o:0:
Expand Down Expand Up @@ -1984,10 +1986,10 @@ PyRun_StringFlags:PyObject*:locals:0:
PyRun_StringFlags:PyCompilerFlags*:flags::

PySeqIter_Check:int:::
PySeqIter_Check::op::
PySeqIter_Check:PyObject *:op:0:

PySeqIter_New:PyObject*::+1:
PySeqIter_New:PyObject*:seq::
PySeqIter_New:PyObject*:seq:0:

PySequence_Check:int:::
PySequence_Check:PyObject*:o:0:
Expand Down Expand Up @@ -2421,7 +2423,7 @@ PyUnicode_GET_LENGTH:PyObject*:o:0:
PyUnicode_KIND:int:::
PyUnicode_KIND:PyObject*:o:0:

PyUnicode_MAX_CHAR_VALUE::::
PyUnicode_MAX_CHAR_VALUE:Py_UCS4:::
PyUnicode_MAX_CHAR_VALUE:PyObject*:o:0:

Py_UNICODE_ISALNUM:int:::
Expand Down Expand Up @@ -2488,7 +2490,7 @@ PyUnicode_FromWideChar:const wchar_t*:w::
PyUnicode_FromWideChar:Py_ssize_t:size::

PyUnicode_AsWideChar:Py_ssize_t:::
PyUnicode_AsWideChar:PyObject*:*unicode:0:
PyUnicode_AsWideChar:PyObject*:unicode:0:
PyUnicode_AsWideChar:wchar_t*:w::
PyUnicode_AsWideChar:Py_ssize_t:size::

Expand Down Expand Up @@ -2541,7 +2543,7 @@ PyUnicode_AsUTF8String:PyObject*:unicode:0:

PyUnicode_AsUTF8AndSize:const char*:::
PyUnicode_AsUTF8AndSize:PyObject*:unicode:0:
PyUnicode_AsUTF8AndSize:Py_ssize_t*:size:0:
PyUnicode_AsUTF8AndSize:Py_ssize_t*:size::

PyUnicode_AsUTF8:const char*:::
PyUnicode_AsUTF8:PyObject*:unicode:0:
Expand Down Expand Up @@ -2864,13 +2866,13 @@ PyUnicodeDecodeError_SetStart:PyObject*:exc:0:
PyUnicodeDecodeError_SetStart:Py_ssize_t:start::

PyWeakref_Check:int:::
PyWeakref_Check:PyObject*:ob::
PyWeakref_Check:PyObject*:ob:0:

PyWeakref_CheckProxy:int:::
PyWeakref_CheckProxy:PyObject*:ob::
PyWeakref_CheckProxy:PyObject*:ob:0:

PyWeakref_CheckRef:int:::
PyWeakref_CheckRef:PyObject*:ob::
PyWeakref_CheckRef:PyObject*:ob:0:

PyWeakref_GET_OBJECT:PyObject*::0:
PyWeakref_GET_OBJECT:PyObject*:ref:0:
Expand Down
Loading

0 comments on commit e636dc8

Please sign in to comment.