-
-
Notifications
You must be signed in to change notification settings - Fork 450
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 with latest mypy and django-stubs #1412
Comments
|
Also tested with: |
I upgraded to django-stubs==4.2.0 and django-stubs-ext==4.2.0 and it is still completely broken:
Is there really no workaround for this problem? |
Please, provide a reproducer. It clearly works for others :) |
Hm hard to reproduce but it crashes at line:
|
And another crash after I comment annotate in previous one:
|
We use 4.1.9 Django now (different as in original bug, but same bug). The key that is searched for type info couple of lines before in transfomers/models.py:
model_module_name + "." + type_name has a value:
And for some reason django_stubs_ext is missing in the list. |
I can also confirm on Python 3.11.4 with
If you disable mypy cache, it does not crash. Here is a piece of offending code: def get_relations(self, obj: WithAnnotations[User]) -> list[str]:
return [name for name, exists in obj.rels.items() if exists] |
How did you disable mypy cache youself?
|
I used https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-no-incremental Removing |
Thank you for the fast answer. It seems my case is a bit different for some reason because it does not work in my case:
|
I have managed to reproduce the issue with the following sample: Inside is runme script
I get:
First issue is with following imports #1614 and second is this one. |
@sobolevn I tried the patch with the reproducable in previous comment, but it does not work:(https://github.com/typeddjango/django-stubs/pull/1613/files#diff-e548f38fb43163048bb2a1c1a209654cbee3c97d5ca25cfe16ca0abc5065e7c6). It seems to go: Then I tried adding:
But still didn't work with the same error :( If I change: it starts working ... |
For me current workaround is to add to mypy.ini:
|
…ommand This PR implements the workaround shown in typeddjango/django-stubs#1412 (comment)
This PR implements the workaround shown in typeddjango/django-stubs#1412 (comment)
This PR implements the workaround shown in typeddjango/django-stubs#1412 (comment)
This PR implements the workaround shown in typeddjango/django-stubs#1412 (comment)
Bug report
Error running latest django-stubs.
It works using django-stubs==1.7.0 without django-stubs-ext installed.
What's wrong
Got crash with django-stubs.
How is that should be
It should not crash.
System information
python
version: 3.11.2 or 3.8.13django
version: 3.2.18mypy
version: 1.1.1django-stubs
version: 1.16.0django-stubs-ext
version: 0.8.0The text was updated successfully, but these errors were encountered: