-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Fix crash when annotating callable definition location #3375
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
Conversation
I have no idea how to add test case for this. [case testUnexpectedKwargsDefinedHere]
import m
m.A(x=1) # E: Unexpected keyword argument "x" for "A"
[file m.py]
class A:
def __init__(self) -> None: # N: "A" defined here
pass doesn't trigger note, because |
@miedzinski if not defn._fullname:
defn._fullname = self.qualified_name(defn.name()) in
(also works with your test example above). |
Do you want me to include it with this patch or would you like to submit it yourself? |
Yes. |
And tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Looks good to me.
I just received a spurious message of the form
The code to issue this message was modified by this PR. I have not been able to repro this "in the lab" yet (the above was part of a huge run on internal code), but I suspect that this might be related to an error in another file that was ignored by |
I also noticed that the spurious note seems to only appear with a cold |
I would propose an alternative solution. We could report the note on the same line as error, but report the source in the note itself, something like:
Adding (TBH, this wording also seems nicer to me than the current one.) |
Finally it may be the case that what I saw was due to some filtering script we have that black-lists certain files. (But the |
Already said that on gitter: this is might have been introduced in this patch, mainly because of fix @ilevkivskyi proposed. Earlier methods lacked fullnames during 2nd pass, so the note wasn't triggered. |
A downside to @ilevkivskyi's solution is that I can't hit Enter in the Emacs |
Fixes #3362.