diff --git a/cpython-unix/build-cpython.sh b/cpython-unix/build-cpython.sh index 9c86aa45..566700e0 100755 --- a/cpython-unix/build-cpython.sh +++ b/cpython-unix/build-cpython.sh @@ -348,6 +348,13 @@ if [ "${PYBUILD_PLATFORM}" != "macos" ]; then fi 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 [[ "${CC}" = "clang" && -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.