Skip to content

semanal: Treat __init_subclass__ as an implicit classmethod #7355

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
merged 3 commits into from
Aug 16, 2019
Merged

semanal: Treat __init_subclass__ as an implicit classmethod #7355

merged 3 commits into from
Aug 16, 2019

Conversation

tavianator
Copy link
Contributor

Fixes #7352

@tavianator
Copy link
Contributor Author

From my reading of https://www.python.org/dev/peps/pep-0487/, we should treat __init_subclass__ as if it were decorated with @classmethod, so this PR does that. Not sure the code is in the right place.

Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

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

Thanks for quick response!

TBH I don't understand completely how this fixes the issue (and how your first PR caused it), but I like the code I see here. It makes things more consistent. In addition I would update the comment for is_class slot in mypy/nodes.py. Currently it reads

'is_class',        # Uses "@classmethod"

I think we should make it

'is_class',        # Uses "@classmethod" (explicit or implicit)

so that people will not make false assertions about defining node. Could you please do this and then I will merge this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

super().__init_subclass__() fails
2 participants