Skip to content

Fix accessing unannotated implicit class methods #7739

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
Oct 20, 2019

Conversation

ilevkivskyi
Copy link
Member

@ilevkivskyi ilevkivskyi commented Oct 17, 2019

Fixes #7735

The fix is quite straightforward, this was not triggered before because all common cases go trough other code paths.

Copy link
Collaborator

@JukkaL JukkaL 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 the quick fix!

@msullivan Is this important enough to warrant a bugfix release?

mypy/typeops.py Outdated
@@ -428,6 +430,11 @@ def callable_type(fdef: FuncItem, fallback: Instance,
column=fdef.column,
implicit=True,
)
if no_self and typ.arg_types:
typ = typ.copy_modified(arg_types=typ.arg_types[1:],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we use bind_self here?

Copy link
Member Author

Choose a reason for hiding this comment

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

At first look it seemed to me bind_self may not work, but now it looks OK to add it in the caller, I will now try to do this. Even if we will discover it doesn't work sometimes, we just need to fix it so it works with unannotated methods.

@msullivan
Copy link
Collaborator

I'm going to wait another day, see if anything else shakes out, and make a call then.

@ilevkivskyi ilevkivskyi merged commit ad85bc5 into python:master Oct 20, 2019
@ilevkivskyi ilevkivskyi deleted the another-init-subclass-fix branch October 20, 2019 17:30
ilevkivskyi added a commit that referenced this pull request Oct 21, 2019
This PR fixes an obvious typo (currently `is_classmethod` is not passed to a nested call). I noticed this while working on #7739
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.

Regression in 0.740 for __init__subclass__
3 participants