Skip to content

Conversation

@iritkatriel
Copy link
Member

@iritkatrieliritkatriel commented Nov 4, 2021

… to NULL

This PR tidies up exception handling in Future/Task._make_cancelled_error to make it clearer what's happening and pave the way for a refactor of how the interpreter represents exceptions.

https://bugs.python.org/issue45711

/* Transfer ownership of exc_value from exc_state to exc since we are
done with it. */
PyException_SetContext(exc, exc_state->exc_value);
exc_state->exc_value = NULL;
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Note that PyErr_Occurred checks whether the type is NULL, not the value. So setting just the value to NULL here doesn't follow the interpreter's semantics for the triplet.

Copy link
Contributor

@asvetlovasvetlov left a comment

Choose a reason for hiding this comment

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

LGTM, the PR is correct.

@iritkatrieliritkatriel merged commit 05fbd60 into python:mainNov 10, 2021
@iritkatrieliritkatriel deleted the bpo-45711-type_val_tb branch November 10, 2021 19:20
remykarem pushed a commit to remykarem/cpython that referenced this pull request Dec 7, 2021
remykarem pushed a commit to remykarem/cpython that referenced this pull request Jan 30, 2022
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@iritkatriel@asvetlov@gvanrossum@the-knights-who-say-ni@bedevere-bot