GeezerVison is showing github.com — [3.14] GH-139653: Only raise an exception (or fatal error) when the stack pointer is about to overflow the stack. (GH-141711) by hroncok · Pull Request #141892 · python/cpython
Conversation
hroncok
commented
Nov 24, 2025
•
edited by github-actions
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
This is my naïve attempt to backport #141711 into the 3.14 branch. I needed to backport several other changes, and at this point am frankly not sure if I know what I am doing :)
Opening as a draft, nevertheless, in case someone wants to take a look.
📚 Documentation preview 📚: https://cpython-previews--141892.org.readthedocs.build/
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
… limit on macOS (pythonGH-139232)
Use `pthread_get_stackaddr_np()` and `pthread_get_stacksize_np()` to determine the stack address and size.
(cherry picked from commit 7016044)
…hon#139668)
Add PyUnstable_ThreadState_SetStackProtection() and
PyUnstable_ThreadState_ResetStackProtection() functions
to set the stack base address and stack size of a Python
thread state.
Co-authored-by: Petr Viktorin <[email protected]>
(cherry picked from commit b99db92)
…ack pointer is about to overflow the stack. (pythonGH-141711)
Only raises if the stack pointer is both below the limit *and* above the stack base.
This prevents false positives for user-space threads, as the stack pointer will be outside those bounds
if the stack has been swapped.
(cherry picked from commit c25a070)
This was referenced Nov 24, 2025
|
@encukou prepared #141661 which contains most changes of this PR but fix also the ABI checks.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
hroncok
commented
Nov 24, 2025
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
I am not sure it includes the Only raise an exception (or fatal error) when the stack pointer is about to overflow the stack commit, but I am happy to close this and finish the work there.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Sure, "Only raise an exception (or fatal error) when the stack pointer is about to overflow the stack" should still be backported. But #141661 is a complex backport for the first part: backport PyUnstable_ThreadState_SetStackProtection() functions and commits preparing this backport.
|
hroncok reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
ericsnowcurrently
Awaiting requested review from ericsnowcurrently
ericsnowcurrently will be requested when the pull request is marked ready for review
ericsnowcurrently is a code owner
markshannon
Awaiting requested review from markshannon
markshannon will be requested when the pull request is marked ready for review
markshannon is a code owner
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.