Skip to content
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

Custom User model raises INTERNAL ERROR #2461

Open
thinkwelltwd opened this issue Dec 9, 2024 · 1 comment
Open

Custom User model raises INTERNAL ERROR #2461

thinkwelltwd opened this issue Dec 9, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@thinkwelltwd
Copy link

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.12
  • django version: 5.1.4
  • mypy version: 1.13
  • django-stubs version: 5.1.0 and higher
  • django-stubs-ext version: 5.1.0 and higher
@thinkwelltwd thinkwelltwd added the bug Something isn't working label Dec 9, 2024
@TreyWW
Copy link

TreyWW commented Dec 28, 2024

Is there any fix to this? If I downgrade django-stubs version all of a sudden I get 51 errors, such as django-stubs\db\models\constraints.pyi:43: note: "CheckConstraint" defined here. But if I try to upgrade I get the same error as you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants