Skip to content

Bind self correctly when mapping class methods from supertype #7474

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 2 commits into from
Sep 5, 2019

Conversation

ilevkivskyi
Copy link
Member

Fixes #2511

Copy link
Collaborator

@msullivan msullivan left a comment

Choose a reason for hiding this comment

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

One question but looks good

mypy/checker.py Outdated
elif isinstance(sym.node, OverloadedFuncDef):
is_class_method = sym.node.is_class
else:
is_class_method = False
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we check is_class for regular FuncDefs? (It can be implicit for certain functions, right?)

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, you are right, it is better to be on the safe side.

@ilevkivskyi ilevkivskyi merged commit 9958295 into python:master Sep 5, 2019
@ilevkivskyi ilevkivskyi deleted the sub-class-self branch September 5, 2019 21:19
ilevkivskyi added a commit that referenced this pull request Sep 10, 2019
Fix a regression caused by #7474

The original PR correctly added `is_classmethod=...` in `bind_self()` for supertype, but I didn't notice the same problem (flag not passed) was also present for _subtype_. The fix is trivial.
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.

classmethod and selftype: incompatible with supertype
2 participants