Skip to content

Internal error with mypy 0.720's new semantic analyzer #108

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

Closed
scop opened this issue Jul 15, 2019 · 1 comment · Fixed by #109
Closed

Internal error with mypy 0.720's new semantic analyzer #108

scop opened this issue Jul 15, 2019 · 1 comment · Fixed by #109

Comments

@scop
Copy link
Contributor

scop commented Jul 15, 2019

I'm seeing internal errors with mypy 0.720's new semantic analyzer. No minimal reproducer yet, but perhaps you can make some sense of the traceback alone:

$ mypy --show-traceback fixtures.py 
fixtures.py:55: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.720
Traceback (most recent call last):
  File "mypy/checkexpr.py", line 3404, in accept
  File "mypy/nodes.py", line 1527, in accept
  File "mypy/checkexpr.py", line 234, in visit_call_expr__ExpressionVisitor_glue
  File "mypy/checkexpr.py", line 243, in visit_call_expr
  File "mypy/checkexpr.py", line 315, in visit_call_expr_inner
  File "mypy/checkexpr.py", line 670, in check_call_expr_with_callee_type
  File "mypy/checkexpr.py", line 728, in check_call
  File "mypy/checkexpr.py", line 835, in check_callable_call
  File "mypy/checkexpr.py", line 573, in apply_function_plugin
  File ".../lib/python3.7/site-packages/mypy_django_plugin/transformers/init_create.py", line 27, in redefine_and_typecheck_model_init
    expected_types = extract_expected_types(ctx, model, is_init=True)
  File ".../lib/python3.7/site-packages/mypy_django_plugin/transformers/init_create.py", line 163, in extract_expected_types
    autofield_info = api.lookup_typeinfo('django.db.models.fields.AutoField')
  File "mypy/checker.py", line 3721, in lookup_typeinfo
  File "mypy/checker.py", line 3772, in lookup_qualified
AssertionError: Internal error: attempted lookup of unknown name
fixtures.py:55: : note: use --pdb to drop into pdb

Same thing with current django-stubs master.

Running mypy with the --no-new-semantic-analyzer flag works around it for now, but that flag is going away soon.

@mkurnikov
Copy link
Member

This is a big rewrite incoming, which will be using Django's AppRegistry and new semantic analyzer, should be out in a week or so. Stay tuned, all those issues should be fixed there.

voidus pushed a commit to voidus/django-stubs that referenced this issue Apr 23, 2024
Since python/mypy#9783 is fixed, we can finally uncomment the refine checks that were not working previously.

Also, this PR fixes all remaining issues for the latest versions of both mypy and pyright.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants