Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions cpython-unix/build-cpython.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
17 changes: 17 additions & 0 deletions cpython-unix/patch-revert-stack-limits-3.15.patch
Original file line number Diff line number Diff line change
@@ -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