django-stubs icon indicating copy to clipboard operation
django-stubs copied to clipboard

Crash when writing cache due to unresolved placeholder

Open ljodal opened this issue 2 years ago • 0 comments

Bug report

What's wrong

On the latest master mypy will crash when writing the cache when checking certain files. This does not happen when checking the full project, so I assume it's a missing .defer() call somewhere. The file being serialized is not the one that's being checked.

LOG:  Writing <snip>.models <snip>/models.py <snip>/models.meta.json <snip>/models.data.json
LOG:  Build finished in 10.155 seconds with 1844 modules, and 0 errors
Traceback (most recent call last):
  File "<snip>/.venv/bin/mypy", line 8, in <module>
    sys.exit(console_entry())
  File "<snip>/.venv/lib/python3.10/site-packages/mypy/__main__.py", line 12, in console_entry
    main(None, sys.stdout, sys.stderr)
  File "mypy/main.py", line 96, in main
  File "mypy/main.py", line 173, in run_build
  File "mypy/build.py", line 154, in build
  File "mypy/build.py", line 230, in _build
  File "mypy/build.py", line 2729, in dispatch
  File "mypy/build.py", line 3087, in process_graph
  File "mypy/build.py", line 3205, in process_stale_scc
  File "mypy/build.py", line 2313, in write_cache
  File "mypy/build.py", line 1470, in write_cache
  File "mypy/nodes.py", line 352, in serialize
  File "mypy/nodes.py", line 3435, in serialize
  File "mypy/nodes.py", line 3372, in serialize
  File "mypy/nodes.py", line 2893, in serialize
  File "mypy/nodes.py", line 1039, in serialize
  File "mypy/types.py", line 536, in serialize
  File "mypy/types.py", line 2530, in serialize
AssertionError: Internal error: unresolved placeholder type <snip>.managers.FlagDeleteOwnedModel

How is that should be

Mypy shouldn't crash 🙃

System information

  • OS:
  • python version: 3.10.4
  • django version: 3.2.14
  • mypy version: 0.961
  • django-stubs version: latest master
  • django-stubs-ext version: not used

ljodal avatar Jul 13 '22 08:07 ljodal