From c597632729364a97952b8f94c3d23ba1713a1d83 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Tue, 11 Feb 2025 16:26:08 -0600 Subject: [PATCH 1/2] Enable the tail call interpreter on 3.14+ --- cpython-unix/build-cpython.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cpython-unix/build-cpython.sh b/cpython-unix/build-cpython.sh index 9c86aa45..b7a05051 100755 --- a/cpython-unix/build-cpython.sh +++ b/cpython-unix/build-cpython.sh @@ -348,6 +348,12 @@ if [ "${PYBUILD_PLATFORM}" != "macos" ]; then fi fi +# On Python 3.14+, enable the tail calling interpreter which is more performant. +# https://docs.python.org/3.14/using/configure.html#cmdoption-with-tail-call-interp +if [ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_14}" ]; then + EXTRA_CONFIGURE_FLAGS="${EXTRA_CONFIGURE_FLAGS} --with-tail-call-interp" +fi + # On Python 3.12+ we need to link the special hacl library provided some SHA-256 # implementations. Since we hack up the regular extension building mechanism, we # need to reinvent this wheel. From 0201b7389972793532de6c34cd02c893aa4daf60 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 12 Feb 2025 07:28:12 -0600 Subject: [PATCH 2/2] Gate to clang builds --- cpython-unix/build-cpython.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cpython-unix/build-cpython.sh b/cpython-unix/build-cpython.sh index b7a05051..566700e0 100755 --- a/cpython-unix/build-cpython.sh +++ b/cpython-unix/build-cpython.sh @@ -349,8 +349,9 @@ if [ "${PYBUILD_PLATFORM}" != "macos" ]; then fi # On Python 3.14+, enable the tail calling interpreter which is more performant. +# This is only available on Clang 19+ # https://docs.python.org/3.14/using/configure.html#cmdoption-with-tail-call-interp -if [ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_14}" ]; then +if [[ "${CC}" = "clang" && -n "${PYTHON_MEETS_MINIMUM_VERSION_3_14}" ]]; then EXTRA_CONFIGURE_FLAGS="${EXTRA_CONFIGURE_FLAGS} --with-tail-call-interp" fi