Skip to content

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented Dec 9, 2025

Increase _PyOS_MIN_STACK_SIZE if Python is built in debug mode.

Increase _PyOS_MIN_STACK_SIZE if Python is built in debug mode.
@vstinner
Copy link
Member Author

vstinner commented Dec 9, 2025

cc @encukou @markshannon @hroncok

On Fedora, we are building Python in debug mode with gcc -O0. I don't know how to detect that -O0 compiler option is used, but we can easily increase the stack margin if Python is built in debug mode (Py_DEBUG macro is defined) which is the case on Fedora.

I don't think that it's common to build Python in release mode without optimization, so checking for Py_DEBUG macro should be enough to fix the issue #140222.

@vstinner
Copy link
Member Author

vstinner commented Dec 9, 2025

"Tests / All required checks pass" job failed with:

Error: The template is not valid. .github/workflows/build.yml (Line: 715, Col: 24): Error reading JToken from JsonReader. Path '', line 0, position 0.

I'm not sure why :-(

@vstinner vstinner marked this pull request as draft December 9, 2025 14:52
Copy link
Member

@markshannon markshannon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Thanks.

@vstinner vstinner marked this pull request as ready for review December 9, 2025 15:22
@vstinner vstinner merged commit 49207a5 into python:main Dec 9, 2025
50 checks passed
@vstinner vstinner deleted the stack_margin branch December 9, 2025 15:25
@vstinner vstinner added the needs backport to 3.14 bugs and security fixes label Dec 9, 2025
@miss-islington-app
Copy link

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 9, 2025
Increase _PyOS_MIN_STACK_SIZE if Python is built in debug mode.
(cherry picked from commit 49207a5)

Co-authored-by: Victor Stinner <vstinner@python.org>
@bedevere-app
Copy link

bedevere-app bot commented Dec 9, 2025

GH-142471 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Dec 9, 2025
vstinner added a commit that referenced this pull request Dec 9, 2025
…142471)

gh-140222: Increase stack margin on debug build (GH-142452)

Increase _PyOS_MIN_STACK_SIZE if Python is built in debug mode.
(cherry picked from commit 49207a5)

Co-authored-by: Victor Stinner <vstinner@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants