← 返回首页
bpo-45711: Use _PyErr_ClearExcState instead of setting only exc_value… by iritkatriel · Pull Request #29404 · python/cpython · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

bpo-45711: Use _PyErr_ClearExcState instead of setting only exc_value…#29404

Merged
iritkatriel merged 2 commits into
python:mainfrom
iritkatriel:bpo-45711-type_val_tb
Nov 10, 2021
Merged

bpo-45711: Use _PyErr_ClearExcState instead of setting only exc_value…#29404
iritkatriel merged 2 commits into
python:mainfrom
iritkatriel:bpo-45711-type_val_tb

Conversation

iritkatriel commented Nov 4, 2021
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

… 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

Comment thread Modules/_asynciomodule.c
/* 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
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

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.

Comment thread Modules/_asynciomodule.c Outdated Show resolved Hide resolved

asvetlov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

LGTM, the PR is correct.

iritkatriel merged commit 05fbd60 into python:main Nov 10, 2021
iritkatriel 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
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
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.

5 participants

Footer

© 2026 GitHub, Inc.