-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-111375: Use NULL
in the exception stack to indicate an exception was handled
#113302
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
Merged
iritkatriel
merged 2 commits into
python:main
from
pR0Ps:bugfix/consistent-exception-stack-values
Dec 21, 2023
Merged
gh-111375: Use NULL
in the exception stack to indicate an exception was handled
#113302
iritkatriel
merged 2 commits into
python:main
from
pR0Ps:bugfix/consistent-exception-stack-values
Dec 21, 2023
+9
−7
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NULL
in the exception stack to indicate an exception was handledNULL
in the exception stack to indicate an exception was handled
Previously, both `NULL` and `Py_None` would be used interchangeably to indicate that an exception is no longer being handled. By ensuring that only `NULL` is used, this opens up the possibility to use `Py_None` to indicate a cleared exception. The difference here would be that clearing would indicate that no exception is currently being handled vs. handling would indicate that the next exception in the stack is currently being handled. This functionality will be used to patch up some edge cases in how the exception context interacts with exceptions thrown into coroutines. This is implemented in this commit by changing code that could add `Py_None` to the exception stack to indicate that an exception is no longer being handled to add `NULL` instead. An assert was also added to ensure that `Py_None` is no longer added to the exception stack. See pythongh-111676 for context.
69ec652
to
c62f8ae
Compare
iritkatriel
reviewed
Dec 20, 2023
🤖 New build scheduled with the buildbot fleet by @iritkatriel for commit 4ac01c0 🤖 If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
I checked a couple of the failed builedbots and the failures seem unrelated (and also appear in the previous runs). But we should check all of them to be sure there's nothing new before merging. Some buildbots are still running. |
ryan-duve
pushed a commit
to ryan-duve/cpython
that referenced
this pull request
Dec 26, 2023
… to indicate that an exception was handled (python#113302)
kulikjak
pushed a commit
to kulikjak/cpython
that referenced
this pull request
Jan 22, 2024
… to indicate that an exception was handled (python#113302)
aisk
pushed a commit
to aisk/cpython
that referenced
this pull request
Feb 11, 2024
… to indicate that an exception was handled (python#113302)
Glyphack
pushed a commit
to Glyphack/cpython
that referenced
this pull request
Sep 2, 2024
… to indicate that an exception was handled (python#113302)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Previously, both
NULL
andPy_None
would be used interchangeably to indicate that an exception is no longer being handled. By ensuring that onlyNULL
is used, this opens up the possibility to usePy_None
to indicate a cleared exception. The difference here would be that clearing would indicate that no exception is currently being handled vs. handling would indicate that the next exception in the stack is currently being handled.This functionality will be used to patch up some edge cases in how the exception context interacts with exceptions thrown into coroutines. See #111676 (comment) for context.
This is implemented in this commit by changing code that could add
Py_None
to the exception stack to indicate that an exception is no longer being handled to addNULL
instead. An assert was also added to ensure thatPy_None
is no longer added to the exception stack.Possible reviewers based on
git blame
: @iritkatriel , @markshannon@contextmanager
function doesn't clearsys.exception()
#111375