Skip to content

gh-116093: ABCMeta.__subclasscheck__ now initializes cls if it is not yet initialized #119719

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

blhsing
Copy link
Contributor

@blhsing blhsing commented May 29, 2024

ABCMeta.__subclasscheck__ now initializes cls if it is not yet initialized

This fixes the issues reported in gh-82266, gh-116093 and gh-119699.

Previously calling issubclass within __init_subclass__ may result in the ABC cache of the parent class of the subclass being instantiated to be mutated since the cache of the subclass is not yet initialized.

This is fixed by forcing __subclasscheck__ to initialize the current class if it is found to not have been initialized.

Co-authored-by: Kirill Podoprigora <[email protected]>
@treykeown
Copy link

Wanted to +1 this, anything I can do to help it get merged?

@treykeown
Copy link

Any reason this is blocked?

@blhsing
Copy link
Contributor Author

blhsing commented Sep 18, 2024

@ncoghlan Can you help review this PR, as you were the reviewer of the original implementation of __init_subclass__? Thanks!

Made references to methods proper links in news.
@treykeown
Copy link

Hey folks - still hacking around this bug. Anything I can do to help get this moving?

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.

3 participants