-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
crash on decorated method redefinition + circular imports #1972
Comments
Got it down to a 2 file version # foo/__init__.py
import foo.base
class Derived(foo.base.Base):
def method(self) -> None:
pass
# foo/base.py
import foo
class Base:
@decorator
def method(self) -> None:
pass |
Where is |
On the original code it was imported from yet another module (which was unannotated), but it wasn't required to reproduce the crash (as I mentioned the code is silly and doesn't run). If I define a dummy implementation, the crash goes away. I couldn't reproduce in a single file scenario, or even removing the (unused) |
I'm sorry, maybe I'm being dense, but I still don't understand whether the
crash repro requires a definition of decorator or not. Unless I am reading
your code wrong it is not defined so it would be flagged as an undefined
name by mypy, right?
|
Let me clarify my previous message, it might have been confusing
To clarify: I expect mypy here to just tell me that "decorator isn't defined" but the observed behaviour is the "*** INTERNAL ERROR ***" shown. |
OK, I can repro, and I have one simplification: in |
Mypy crashes with an internal crash on this multi-file package. The example code doesn't make much sense (I arrived to it by trimming a much larger project that's crashing mypy), but I should probably just get errors. If I have the following three files:
And then I run
mypy foo/base.py
, I get the followingThe text was updated successfully, but these errors were encountered: