You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
❯ pip freeze
asgiref==3.8.1
Django==5.0.4
django-stubs==5.0.3
django-stubs-ext==5.1.1
mypy==1.11.2
mypy-extensions==1.0.0
sqlparse==0.5.3
types-PyYAML==6.0.12.20241230
typing_extensions==4.12.2
❯ mypy --no-incremental --show-traceback .
./tstapp/models.py:11: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 1.11.2
Traceback (most recent call last):
File "mypy/semanal.py", line 7087, in accept
File "mypy/nodes.py", line 819, in accept
File "mypy/semanal.py", line 874, in visit_func_def
File "mypy/semanal.py", line 919, in analyze_func_def
File "mypy/semanal.py", line 6742, in defer
AssertionError: Must not defer during final iteration
./tstapp/models.py:11: : note: use --pdb to drop into pdb
How is that should be
Running the same example with django-stubs 5.0.2:
❯ pip freeze
asgiref==3.8.1
Django==5.0.4
django-stubs==5.0.2
django-stubs-ext==5.1.1
mypy==1.10.1
mypy-extensions==1.0.0
sqlparse==0.5.3
types-PyYAML==6.0.12.20241230
typing_extensions==4.12.2
❯ mypy --show-traceback .
Success: no issues found in 13 source files
Example project
You can reproduce this by downloading this project (contains the model definition above) and running it locally: tst.zip
Bug report
Starting from django-stubs 5.0.3, the following example crashes with an internal mypy error:
Output:
How is that should be
Running the same example with django-stubs 5.0.2:
Example project
You can reproduce this by downloading this project (contains the model definition above) and running it locally:
tst.zip
Install django-stubs 5.0.2 without the problem:
Install django-stubs 5.0.3 with the problem
Workaround
The crash can be worked around by putting
TMyBase
after theMyBase
definition.System information
python
version: 3.12.7django
version: I tested with 5.0.4 and 5.1.4 with the same resultThe text was updated successfully, but these errors were encountered: