Open
Description
Bug report
I'm adding type hints to a rather large Django project with a custom user model, discovered a bug after upgrading to Django 5.1.4.
What's wrong
$ mypy --show-traceback apps/app-name
/usr/local/lib/python3.12/dist-packages/django-stubs/http/request.pyi:58: 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.13.0
Traceback (most recent call last):
File "mypy/semanal.py", line 7113, in accept
File "mypy/nodes.py", line 1351, in accept
File "mypy/semanal.py", line 3153, in visit_assignment_stmt
File "mypy/semanal.py", line 3671, in process_type_annotation
File "mypy/semanal.py", line 6767, in defer
AssertionError: Must not defer during final iteration
/usr/local/lib/python3.12/dist-packages/django-stubs/http/request.pyi:58: : note: use --pdb to drop into pdb
How it should be
I've narrowed the problem down to this commit. Prior to that, it did not crash.
git checkout 3e6f1a6212c2b8d66c4146c8462879ded8728da6
python3.12 -m pip install .
Then run mypy:
$ mypy apps/app-name/
<snip>
Found 10 errors in 4 files (checked 62 source files)
System information
- OS:
python
version: 3.12django
version: 5.1.4mypy
version: 1.13django-stubs
version: 5.1.0 and higherdjango-stubs-ext
version: 5.1.0 and higher
Activity