-
-
Notifications
You must be signed in to change notification settings - Fork 3k
get_class_decorator_hook_2: fix fullname #16063
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
base: master
Are you sure you want to change the base?
Conversation
if isinstance(expr, CallExpr): | ||
return self.get_fullname_for_hook(expr.callee) | ||
elif isinstance(expr, IndexExpr): | ||
expr = expr.callee | ||
if isinstance(expr, IndexExpr): |
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.
The culprit - see testClassDecoratorHook2_incorrect
for repro.
Basically, if we have
@my_decorator()()
^^^^^^^^^^^^^^^^
then I feel we ought to use the whole callable, and not recurse in, but maybe I'm missing some use case?
cc @JukkaL re |
501b2dd
to
6bcf3f2
Compare
This comment has been minimized.
This comment has been minimized.
The syntax errors you're getting on Python 3.8 are likely because PEP 614 was first implemented in Python 3.9 |
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
def my_decorator(t: Any) -> Any: | ||
raise | ||
|
||
@my_decorator()() |
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.
What will happen for @my_decorator(1)()
?
Fixes #16062.