-
-
Notifications
You must be signed in to change notification settings - Fork 459
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
Django 4.0.5 crashes with mypy and django-stubs #1013
Comments
Push. |
Hi, we need a minimal repro to be able to fix that 👋 |
@sobolevn Sorry, pretty difficult for me to create a reproductive repo. Im pretty sure it has to with one of our models, but I would love to debug this and find out where its thrown :( File "/Users/thorbenluepkes/work/newmarkets/venv/lib/python3.10/site-packages/mypy_django_plugin/transformers/orm_lookups.py", line 40, in typecheck_queryset_filter
lookup_type = django_context.resolve_lookup_expected_type(ctx, model_cls, lookup_kwarg)
File "/Users/thorbenluepkes/work/newmarkets/venv/lib/python3.10/site-packages/mypy_django_plugin/django/context.py", line 375, in resolve_lookup_expected_type
lookup_parts, field_parts, is_expression = query.solve_lookup_type(lookup)
File "/Users/thorbenluepkes/work/newmarkets/venv/lib/python3.10/site-packages/django/db/models/sql/query.py", line 1217, in solve_lookup_type
_, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
File "/Users/thorbenluepkes/work/newmarkets/venv/lib/python3.10/site-packages/django/db/models/sql/query.py", line 1656, in names_to_path
name = opts.pk.name
AttributeError: 'NoneType' object has no attribute 'name' just suggests its some model, but i cant see in which one its thrown.. |
FYI, I see a similar stack trace (not identical) in
Dropping into
Obviously, it used to do more, but I can cause the crash with just this code. Also, this is obviously meant to be an abstract class that other classes inherit from. It used to have I am on Django 3.2.16, mypy 0.982, django-stubs 1.12.0. |
I think this should be closed via: #1328 |
Bug Report
AttributeError: 'NoneType' object has no attribute 'name'
Looks similar to #625
Traceback
To Reproduce
django==4.0.5
mypy==0.960
django-stubs==1.12.0
pydantic==1.9.1
Instal these packages and run mypy
Your Environment
--pretty --show-error-codes
mypy.ini
(and other config files): ```3.10.2
Using a bash script to run
dmypy
Filters out some django-specific files, and exlucdes nodes modules and virtual env.
It is not an issue on mypy version
0.931
and before. The guys over at Mypy assume its something inside themypy-django-plugin
, you can read more here python/mypy#13005The text was updated successfully, but these errors were encountered: