Skip to content

gh-142317: Do not set a stack size for cpython on MacOS#150170

Draft
boomanaiden154 wants to merge 1 commit into
python:mainfrom
boomanaiden154:fix-142317
Draft

gh-142317: Do not set a stack size for cpython on MacOS#150170
boomanaiden154 wants to merge 1 commit into
python:mainfrom
boomanaiden154:fix-142317

Conversation

@boomanaiden154
Copy link
Copy Markdown

@boomanaiden154 boomanaiden154 commented May 20, 2026

We were originally setting a stack size beyond the default limit to allow the interpreter to hit the default recursion limit after some MacOS changes made it no longer possible to actually use RLIMIT_STACK to adjust the default stack size. 5bbbc73 was the commit implenting that.

However, we no longer need extra stack space to hit the default recursion limit after B4903afd4debbbd71dc49a2c8fefa74a3b6c6832.

Given that setting the default stack size prevents setting RLIMIT_STACK in other circumstances where it would be useful (e.g., inside of LLVM's integrated tester where we want to emulate ulimit), and that it is no longer necessary to achieve the stated goal, do not set the stack size and set the thread stack size limit to the platform default to match what we were doing before.

I've added a simple regression test that ensures we can call setrlimit with resource.RLIMIT_STACK at all.

Fixes #142317.

We were originally setting a stack size beyond the default limit to allow the
interpreter to hit the default recursion limit after some MacOS changes made
it no longer possible to actually use RLIMIT_STACK to adjust the default stack
size. 5bbbc73 was the commit implenting that.

However, we no longer need extra stack space to hit the default recursion limit
after B4903afd4debbbd71dc49a2c8fefa74a3b6c6832.

Given that setting the default stack size prevents setting RLIMIT_STACK in
other circumstances where it would be useful (e.g., inside of LLVM's
integrated tester where we want to emulate ulimit), and that it is no longer
necessary to achieve the stated goal, do not set the stack size and set the
thread stack size limit to the platform default to match what we were
doing before.

Fixes python#142317.
@python-cla-bot
Copy link
Copy Markdown

python-cla-bot Bot commented May 20, 2026

All commit authors signed the Contributor License Agreement.

CLA signed

@boomanaiden154
Copy link
Copy Markdown
Author

Looks like there are CI failures that I did not see locally initially...

@boomanaiden154 boomanaiden154 marked this pull request as draft May 20, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setting resource.RLIMIT_STACK not working on MacOS

1 participant