Skip to content
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

Merged

Conversation

@onlined
Copy link
Contributor

onlined commented Sep 2, 2019

Fixes #7243.

Copy link
Collaborator

ilevkivskyi left a comment

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?

onlined added 2 commits Sep 3, 2019
@onlined

This comment has been minimized.

Copy link
Contributor Author

onlined commented Sep 3, 2019

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 find_member with __call__. Could you give a suggestion?

@ilevkivskyi

This comment has been minimized.

Copy link
Collaborator

ilevkivskyi commented Sep 3, 2019

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 constraints.py, join.py, etc. There is no need to add a test for every call site, just couple test cases will be enough.

onlined added 2 commits Sep 10, 2019
@onlined

This comment has been minimized.

Copy link
Contributor Author

onlined commented Sep 15, 2019

Added.

Copy link
Collaborator

ilevkivskyi left a comment

👍 Nice!

@ilevkivskyi ilevkivskyi merged commit 125ef0d into python:master Sep 15, 2019
2 checks passed
2 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.