Skip to content

Assertion error on loading .mypy_cache data #6108

@asvetlov

Description

@asvetlov

Hi. I see an assertion when run mypy on cached data.
rm -rf .mypy_cache or incremental = False helps but working support for cached data would be nice.
The assertion happens not always but after a relative big source code change (isort + black run).

Sorry, I cannot provide a code for the problem reproducion (it is a private closed source probject).
Error traceback is applied.

Traceback (most recent call last):
  File "/home/andrew/.virtualenvs/platform-api-clients/bin/mypy", line 11, in <module>
    sys.exit(console_entry())
  File "/home/andrew/.virtualenvs/platform-api-clients/lib/python3.6/site-packages/mypy/__main__.py", line 7, in console_entry
    main(None)
  File "/home/andrew/.virtualenvs/platform-api-clients/lib/python3.6/site-packages/mypy/main.py", line 92, in main
    res = build.build(sources, options, None, flush_errors, fscache)
  File "/home/andrew/.virtualenvs/platform-api-clients/lib/python3.6/site-packages/mypy/build.py", line 156, in build
    result = _build(sources, options, alt_lib_path, flush_errors, fscache)
  File "/home/andrew/.virtualenvs/platform-api-clients/lib/python3.6/site-packages/mypy/build.py", line 206, in _build
    graph = dispatch(sources, manager)
  File "/home/andrew/.virtualenvs/platform-api-clients/lib/python3.6/site-packages/mypy/build.py", line 2232, in dispatch
    process_graph(graph, manager)
  File "/home/andrew/.virtualenvs/platform-api-clients/lib/python3.6/site-packages/mypy/build.py", line 2525, in process_graph
    process_fresh_modules(graph, prev_scc, manager)
  File "/home/andrew/.virtualenvs/platform-api-clients/lib/python3.6/site-packages/mypy/build.py", line 2609, in process_fresh_modules
    graph[id].load_tree()
  File "/home/andrew/.virtualenvs/platform-api-clients/lib/python3.6/site-packages/mypy/build.py", line 1604, in load_tree
    self.tree = MypyFile.deserialize(data)
  File "/home/andrew/.virtualenvs/platform-api-clients/lib/python3.6/site-packages/mypy/nodes.py", line 277, in deserialize
    tree.names = SymbolTable.deserialize(data['names'])
  File "/home/andrew/.virtualenvs/platform-api-clients/lib/python3.6/site-packages/mypy/nodes.py", line 2864, in deserialize
    st[key] = SymbolTableNode.deserialize(value)
  File "/home/andrew/.virtualenvs/platform-api-clients/lib/python3.6/site-packages/mypy/nodes.py", line 2812, in deserialize
    node = SymbolNode.deserialize(data['node'])
  File "/home/andrew/.virtualenvs/platform-api-clients/lib/python3.6/site-packages/mypy/nodes.py", line 200, in deserialize
    return method(data)
  File "/home/andrew/.virtualenvs/platform-api-clients/lib/python3.6/site-packages/mypy/nodes.py", line 478, in deserialize
    for d in data['items']])
  File "/home/andrew/.virtualenvs/platform-api-clients/lib/python3.6/site-packages/mypy/nodes.py", line 446, in __init__
    assert len(items) > 0
AssertionError

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions