Skip to content

gh-113848: Use PyErr_GivenExceptionMatches() for check for CancelledError#113849

Merged
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:CancelledError-check-in-c-code
Jan 9, 2024
Merged

gh-113848: Use PyErr_GivenExceptionMatches() for check for CancelledError#113849
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:CancelledError-check-in-c-code

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Jan 9, 2024

Copy link
Copy Markdown
Member

@gvanrossum gvanrossum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks like a nice improvement (though it hinges on this being an infallible legacy API).

Technically it's not 100% correct, since this C API doesn't appear to honor overriding __instancecheck__, but we use this function and PyErr_ExceptionMatches already in other places in this module, and I really don't think people should play games with subclassing CancelledError anyways.

@serhiy-storchaka
serhiy-storchaka merged commit 5273655 into python:main Jan 9, 2024
@serhiy-storchaka
serhiy-storchaka deleted the CancelledError-check-in-c-code branch January 9, 2024 19:41
kulikjak pushed a commit to kulikjak/cpython that referenced this pull request Jan 22, 2024
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
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.

2 participants