Skip to content

mypy --follow-imports error or skip crashes with numpy 2.0.0 #17396

Description

@tomsilver

This is a mypy crash revealed by the release of numpy 2.0.0. See also numpy/numpy#26720

Crash Report

The crash is shown below. Notes:

  • The crash does not happen with numpy==1.26.4
  • The same crash happens with mypy test.py --follow-imports skip
  • It does not happen with mypy test.py --follow-imports normal

Traceback

Traceback (most recent call last):
  File "/Users/tom/Desktop/venv/bin/mypy", line 8, in <module>
    sys.exit(console_entry())
  File "/Users/tom/Desktop/venv/lib/python3.10/site-packages/mypy/__main__.py", line 15, in console_entry
    main()
  File "mypy/main.py", line 100, in main
  File "mypy/main.py", line 182, in run_build
  File "mypy/build.py", line 192, in build
  File "mypy/build.py", line 266, in _build
  File "mypy/build.py", line 2942, in dispatch
  File "mypy/build.py", line 3340, in process_graph
  File "mypy/build.py", line 3467, in process_stale_scc
  File "mypy/build.py", line 2503, in write_cache
  File "mypy/build.py", line 1564, in write_cache
  File "mypy/nodes.py", line 387, in serialize
  File "mypy/nodes.py", line 3936, in serialize
  File "mypy/nodes.py", line 3873, in serialize
  File "mypy/nodes.py", line 3304, in serialize
  File "mypy/types.py", line 667, in serialize
  File "mypy/types.py", line 2430, in serialize
  File "mypy/types.py", line 1468, in serialize
  File "mypy/types.py", line 667, in serialize
  File "mypy/types.py", line 3067, in serialize
AssertionError: Internal error: unresolved placeholder type None

To Reproduce

  1. pip install numpy mypy
  2. echo "import numpy" > test.py
  3. mypy test.py --follow-imports error

Your Environment

  • Mypy version used: mypy 1.10.0 (compiled: yes)
  • Mypy command-line flags: --follow-imports error
  • Mypy configuration options from mypy.ini (and other config files): N/A
  • Python version used: 3.10.6
  • Operating system and version: MacOS Monterey (12.5.1)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions