-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Fix crash related with __getattr__ and __call__ #7446
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
Fix crash related with __getattr__ and __call__ #7446
Conversation
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 for PR! I think this may be not the best to way to fix this however. An ideal fix would be to actually implement #3832. But this may be a too big task, so I think it would also make sense to essentially copy the logic from your previous PR #6655 to find_member()
.
Also, could you please add some tests?
Thanks for the review! I changed the logic as you proposed. I will add tests, but I couldn't think of some simple snippet which can call |
I think the simplest way to trigger the crash is: from typing import Callable, Any
class C:
def __getattr__(self, attr: str) -> C: ...
def do(cd: Callable[..., Any]) -> None:
...
do(C()) Using this I think you get the idea how to trigger similar crashes in |
Added. |
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.
👍 Nice!
1. limit the version of the test deps in test-requirements.txt by release data (i.e. Jan 16 2019, when v0.660 was released) 2. ./runtests.py and all tests pass 3. add tests from python#6655 and python#7446 and ./runtests.py and new test cases fail 4. apply changes from python#6655 and python#7446 manually 5. run tests and all pass
Fixes #7243.