https://github.com/python/cpython/commit/1878fe814a13cd620feff17ebcac774a2925d445
commit: 1878fe814a13cd620feff17ebcac774a2925d445
branch: 3.14
author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com>
committer: hugovk <1324225+hug...@users.noreply.github.com>
date: 2025-08-10T16:55:29+03:00
summary:

[3.14] gh-131338: Disable computed stack limit checks on non-glibc linux 
(GH-134336) (#137175)

Co-authored-by: R. David Murray <rdmur...@bitdance.com>
Co-authored-by: Kumar Aditya <kumaradi...@python.org>
Co-authored-by: Victor Stinner <vstin...@python.org>

files:
A 
Misc/NEWS.d/next/Core_and_Builtins/2025-07-25-22-31-52.gh-issue-131338.zJDCMp.rst
M Python/ceval.c

diff --git 
a/Misc/NEWS.d/next/Core_and_Builtins/2025-07-25-22-31-52.gh-issue-131338.zJDCMp.rst
 
b/Misc/NEWS.d/next/Core_and_Builtins/2025-07-25-22-31-52.gh-issue-131338.zJDCMp.rst
new file mode 100644
index 00000000000000..6c064e8f4a0339
--- /dev/null
+++ 
b/Misc/NEWS.d/next/Core_and_Builtins/2025-07-25-22-31-52.gh-issue-131338.zJDCMp.rst
@@ -0,0 +1,2 @@
+Disable computed stack limit checks on non-glibc linux platforms to fix
+crashes on deep recursion.
diff --git a/Python/ceval.c b/Python/ceval.c
index 42080f77f2a046..e5b1b82e45e14c 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -439,7 +439,11 @@ _Py_InitializeRecursionLimits(PyThreadState *tstate)
     _tstate->c_stack_soft_limit = _tstate->c_stack_hard_limit + 
_PyOS_STACK_MARGIN_BYTES;
 #else
     uintptr_t here_addr = _Py_get_machine_stack_pointer();
-#  if defined(HAVE_PTHREAD_GETATTR_NP) && !defined(_AIX) && 
!defined(__NetBSD__)
+/// 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
+/// compared to the old stack size estimation.  (We assume musl is not glibc.)
+#  if defined(HAVE_PTHREAD_GETATTR_NP) && !defined(_AIX) && \
+        !defined(__NetBSD__) && (defined(__GLIBC__) || !defined(__linux__))
     size_t stack_size, guard_size;
     void *stack_addr;
     pthread_attr_t attr;

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: arch...@mail-archive.com

Reply via email to