-
-
Notifications
You must be signed in to change notification settings - Fork 521
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Bug report
What's wrong
Still working on a minimal repro, but here's my stack trace:
Traceback (most recent call last):
File "/.venv/bin/mypy", line 8, in <module>
sys.exit(console_entry())
File "/.venv/lib/python3.9/site-packages/mypy/__main__.py", line 11, in console_entry
main(None, sys.stdout, sys.stderr)
File "mypy/main.py", line 87, in main
File "mypy/main.py", line 165, in run_build
File "mypy/build.py", line 179, in build
File "mypy/build.py", line 254, in _build
File "mypy/build.py", line 2697, in dispatch
File "mypy/build.py", line 3021, in process_graph
File "mypy/build.py", line 3137, in process_stale_scc
File "mypy/errors.py", line 565, in file_messages
File "mypy/errors.py", line 538, in format_messages
IndexError: list index out of range
I have a FooManager:
from django.db import models
class FooManager(models.Manager):
def create_with_foo(self, *args, **kwargs) -> models.Model: # Line 7
pass
def save_foo(self, model: models.Model) -> None: # Line 25
passIt's often used on models like this:
objects = FooManager()For some reason, three completely unrelated files are getting these errors:
some_file.py:7: error: Name "models" is not defined [name-defined]
)
^
some_file.py:25: error: Name "models" is not defined [name-defined]
does_not_matter_anything_could_be_here()
I tried adding whitespace to the top of some_file.py but the line numbers didn't change. Odd. I looked through my project for files where lines 7 and 25 referenced models and found my FooManager. I added 1 line to the top of FooManager and the mypy errors incremented by 1. I added 100 lines to the top of FooManager and got this sweet stack trace.
How is that should be
There should be no errors.
System information
- OS:
pythonversion: 3.9.6djangoversion: 3.1mypyversion: 0.910django-stubsversion: 1.8.0django-stubs-extversion: 0.3.1
antonagestam and flaeppe
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working