| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…assumes Where a thread's stack size cannot be queried, the interpreter assumes Py_C_STACK_SIZE, and a smaller thread overflows instead of raising RecursionError. run_with_limited_c_stack() now raises such a size to C_STACK_SIZE. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
| Back | FazBrowse Home | New Git URL |
Where hardware_stack_limits() cannot query the running thread's stack (AIX, NetBSD, non-glibc Linux), the interpreter assumes Py_C_STACK_SIZE. A test thread created with less than that overflows before the recursion guard notices, so the test crashes instead of getting RecursionError. test_lazy_import asks for 256 KiB and does exactly that on Alpine.
run_with_limited_c_stack() now probes once whether the real size is visible — two threads of different sizes report the same headroom only when the fixed estimate is in use — and raises a too-small size to C_STACK_SIZE when it is not.
Verified both ways: on Alpine the probe returns False, the clamp applies and test_lazy_import passes with an unpatched ceval.c; on glibc it returns True, nothing is clamped, and the tests using the helper are unaffected.
Independent of #159882, which fixes the detection itself.
🤖 Generated with Claude Code