diff --git a/cpython-unix/build-cpython.sh b/cpython-unix/build-cpython.sh index 32992ee5..fd2469c5 100755 --- a/cpython-unix/build-cpython.sh +++ b/cpython-unix/build-cpython.sh @@ -522,6 +522,11 @@ if [ -n "${CPYTHON_OPTIMIZED}" ]; then fi fi +# Revert problematic C stack limits refactoring on 3.15 (macOS build issue) +if [[ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_15}" && "${PYBUILD_PLATFORM}" = macos* ]]; then + patch -p1 -i "${ROOT}/patch-revert-stack-limits-3.15.patch" +fi + if [ -n "${CPYTHON_LTO}" ]; then CONFIGURE_FLAGS="${CONFIGURE_FLAGS} --with-lto" fi @@ -622,12 +627,6 @@ if [[ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_14}" && -n "${CROSS_COMPILING}" && "$ PROFILE_TASK="${PROFILE_TASK} --ignore test_strftime_y2k" fi -# On 3.15+ `test_json.test_recursion.TestCRecursion.test_highly_nested_objects_decoding` fails during -# PGO due to RecursionError not being raised as expected. See https://github.com/python/cpython/issues/140125 -if [[ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_15}" ]]; then - PROFILE_TASK="${PROFILE_TASK} --ignore test_json" -fi - # ./configure tries to auto-detect whether it can build 128-bit and 256-bit SIMD helpers for HACL, # but on x86-64 that requires v2 and v3 respectively, and on arm64 the performance is bad as noted # in the comments, so just don't even try. (We should check if we can make this conditional) diff --git a/cpython-unix/patch-revert-stack-limits-3.15.patch b/cpython-unix/patch-revert-stack-limits-3.15.patch new file mode 100644 index 00000000..5d5047e8 --- /dev/null +++ b/cpython-unix/patch-revert-stack-limits-3.15.patch @@ -0,0 +1,17 @@ +diff --git a/Python/ceval.c b/Python/ceval.c +index f48f412fab8..3bf1c098003 100644 +--- a/Python/ceval.c ++++ b/Python/ceval.c +@@ -448,12 +448,6 @@ hardware_stack_limits(uintptr_t *top, uintptr_t *base) + ULONG guarantee = 0; + SetThreadStackGuarantee(&guarantee); + *base = (uintptr_t)low + guarantee; +-#elif defined(__APPLE__) +- pthread_t this_thread = pthread_self(); +- void *stack_addr = pthread_get_stackaddr_np(this_thread); // top of the stack +- size_t stack_size = pthread_get_stacksize_np(this_thread); +- *top = (uintptr_t)stack_addr; +- *base = ((uintptr_t)stack_addr) - stack_size; + #else + /// XXX musl supports HAVE_PTHRED_GETATTR_NP, but the resulting stack size + /// (on alpine at least) is much smaller than expected and imposes undue limits