Skip to content
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

semanal: Treat __init_subclass__ as an implicit classmethod #7355

Merged
merged 3 commits into from Aug 16, 2019

Conversation

@tavianator
Copy link
Contributor

commented Aug 16, 2019

Fixes #7352

@tavianator

This comment has been minimized.

Copy link
Contributor Author

commented Aug 16, 2019

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
Collaborator

left a comment

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.

@ilevkivskyi ilevkivskyi merged commit 5b8ca1f into python:master Aug 16, 2019
2 checks passed
2 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.