Skip to content

Fix --incremental crash on Type[...] #4038

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 2 commits into from
Oct 11, 2017

Conversation

ilevkivskyi
Copy link
Member

@ilevkivskyi ilevkivskyi commented Sep 30, 2017

This fixes the second traceback reported in #3852. This also improves member lookup on Type[...] by moving it to a later stage (checkmember.py instead of some manipulations in TypeType constructor that are dangerous during de-serialization).

By the way it looks like the first traceback reported in #3852 is just another manifestation of #3052, but instead of just deleting a class it is replaced by a Var or by a FunctionDef.

Also fixes #4058.

@gvanrossum
Copy link
Member

Is this something urgent (fixing a regression in a recent change) that should be cherry-picked into the release branch? Or is this something that has been around for a long time? It seems the second crash in #3852 is related to pointing mypypath to site-packages, which is not recommended.

@ilevkivskyi
Copy link
Member Author

Is this something urgent (fixing a regression in a recent change) that should be cherry-picked into the release branch? Or is this something that has been around for a long time?

The bug is quite old (around a year), it started to be a crash in 0.510. So I don't think it is something urgent.

It seems the second crash in #3852 is related to pointing mypypath to site-packages, which is not recommended.

The crash doesn't depend on MYPYPATH setting, but the probability to find more dynamic code in libraries is higher. For example, the crash appears on type(f) , where f is a callable other than class object.

@JukkaL JukkaL self-assigned this Oct 9, 2017
self.item = item.fallback
else:
self.item = item
self.item = item
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why does this change help? Is it because the type attribute of an Instance might refer to FakeInfo during deserialization?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes.

Copy link
Member Author

Choose a reason for hiding this comment

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

(Or previously to None)

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.

LGTM. Thanks for the fix!

@JukkaL JukkaL merged commit bd1b3d7 into python:master Oct 11, 2017
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.

self.__class__.__name__ has type Any in class derived from Any
3 participants