-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Internal Error: maptype.py: AttributeError: attribute 'type_vars' of 'TypeInfo' undefined #7806
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
Comments
I was able to find a small example that results in a similar crash: # pkg/__init__.py
mgr = object() # pkg/sub/__init__.py
# (empty) # pkg/sub/m.py
class C:
from .. import mgr
def f(self) -> None:
return self.mgr.whatever()
This traceback is a bit different since it's from a non-compiled mypy. |
I prepared a PR but it lacks unit tests. @JukkaL As far as I understand, we are getting |
Does it make more sense to remove custom |
@vemel -- I think the better fix here is to figure out why the FakeInfo is sneaking past the initial semantic analysis phase. If everything is working, every FakeInfo ought to be replaced by a legitimate TypeInfo by the time we make it to the type-checking phase and actually start using the object -- see FakeInfo's docstring for more details about this. Removing To put it another way, what FakeInfo is doing is breaking the Liskov substitution principle to the fullest extent possible while still remaining a subclass of TypeInfo. This technique lets us defer distinguishing between ready and not-ready TypeInfos to runtime: it turns out attempting to make this distinction at the type level (e.g. scatter around "if this object is a ready instance..." checks) ends up making the code pretty messy and difficult to maintain. |
should there be a class for |
I don't think that there's a simple way to do this, without littering the code with many runtime type checks. |
Ran into this issue which completely breaks our entire linting pipeline. Does anybody have a workaround for this? |
|
Fixes python#11045, fixes huggingface/transformers#13390 Fixes python#10488 Fixes python#7045 Fixes python#7806 Fixes python#11641 Fixes python#11351 Fixes python#10488 Co-authored-by: @A5rocks
Bug
or a mock-up repro if the source is private. We would appreciate
if you try to simplify your case to a minimal repro.
Hints on how to simply create a minimal example are appreciated.
0.740
Not checked yet.
The text was updated successfully, but these errors were encountered: