Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-42500: Fix recursion in or after except #23568

Merged
merged 2 commits into from Dec 2, 2020

Conversation

markshannon
Copy link
Member

@markshannon markshannon commented Nov 30, 2020

Currently we try to track whether we are handling an exception, and adapt behavior accordingly.
This is fragile, and may cause the C stack to overflow, even if the Python stack does not.

Instead, this PR allows some headroom for exception formatting and initialization code. This means we can create exceptions and handle RecursionErrors more reliably.

This is still an imperfect solution, as we really should distinguish between recursion errors (the Python stack is too deep) and stack overflow errors (the C stack is near exhaustion).

https://bugs.python.org/issue42500

@markshannon markshannon added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Nov 30, 2020
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @markshannon for commit 04d97f3 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Nov 30, 2020
@markshannon markshannon merged commit 4e7a69b into python:master Dec 2, 2020
@markshannon markshannon added the needs backport to 3.9 only security fixes label Feb 10, 2021
@miss-islington
Copy link
Contributor

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

@miss-islington
Copy link
Contributor

Sorry, @markshannon, I could not cleanly backport this to 3.9 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 4e7a69bdb63a104587759d7784124492dcdd496e 3.9

markshannon added a commit to markshannon/cpython that referenced this pull request Feb 10, 2021
* Use counter, rather boolean state when handling soft overflows.

(cherry picked from commit 4e7a69b)
@markshannon markshannon deleted the fix-recursion-in-except branch February 10, 2021 13:37
@bedevere-bot
Copy link

GH-24501 is a backport of this pull request to the 3.9 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Feb 10, 2021
ambv pushed a commit that referenced this pull request Mar 2, 2021
* Use counter, rather boolean state when handling soft overflows.

(cherry picked from commit 4e7a69b)
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
* Use counter, rather boolean state when handling soft overflows.
gpshead added a commit to gpshead/cpython that referenced this pull request Apr 4, 2021
…nGH-23568) (python#24501)"

This reverts commit 8b795ab.

It changed the PyThreadState structure size, breaking the ABI in 3.9.3.
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.

None yet

4 participants