Skip to content

Plugin regression with mypy 0.99x: FieldDoesNotExist #1261

@intgr

Description

@intgr

mypy_django_plugin causes a mypy internal error when running typecheck_tests.py on Django 3.2 source with mypy 0.991. Does not occur with Django 4.0.

See typecheck failures in PR #1260.

I have not yet had the time to investigate this. Any help would be welcome.

  File "/home/runner/work/django-stubs/django-stubs/mypy_django_plugin/transformers/fields.py", line 117, in set_descriptor_types_for_field_callback
  File "/home/runner/work/django-stubs/django-stubs/mypy_django_plugin/transformers/fields.py", line 215, in transform_into_proper_return_type
  File "/home/runner/work/django-stubs/django-stubs/mypy_django_plugin/transformers/fields.py", line 41, in _get_current_field_from_assignment
  File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/site-packages/django/db/models/options.py", line 610, in get_field
  File "mypy/checkexpr.py", line 1004, in apply_function_plugin
  File "mypy/checkexpr.py", line 1181, in check_call_expr_with_callee_type
  File "mypy/checkexpr.py", line 1264, in check_call
  File "mypy/checkexpr.py", line 1466, in check_callable_call
  File "mypy/checkexpr.py", line 410, in visit_call_expr
  File "mypy/checkexpr.py", line 4665, in accept
  File "mypy/checkexpr.py", line 530, in visit_call_expr_inner
  File "mypy/nodes.py", line 1841, in accept
/home/runner/work/django-stubs/django-stubs/django-source/tests/model_fields/models.py:176: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
FieldDoesNotExist: RenamedField has no field named 'modelname'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcrash"Internal error" crashes from mypyhelp wantedExtra attention is neededmypy-pluginIssues specific to mypy_django_plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions