When importing lastest version of numpy>=2.0.0, report "AssertionError: Internal error: unresolved placeholder type None" when using stubgen.
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "D:\Program Files\Python\Python312\Scripts\stubgen.exe\__main__.py", line 7, in <module>
File "mypy\stubgen.py", line 1882, in main
File "mypy\stubgen.py", line 1678, in generate_stubs
File "mypy\stubgen.py", line 1610, in generate_asts_for_modules
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 3468, 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
report "AssertionError: Internal error: unresolved placeholder type None" when using stubgen command.
Bug Report
When importing lastest version of numpy>=2.0.0, report "AssertionError: Internal error: unresolved placeholder type None" when using stubgen.
The error looks like this:
To Reproduce
Install latest version of
numpy>=2.0.0, then create a Python file with only this import, egg.foo.py.using the
stubgencommand to generatepyifileExpected Behavior
gernerated the
pyifile viastubgencommandActual Behavior
report "AssertionError: Internal error: unresolved placeholder type None" when using
stubgencommand.I tried to downgrade numpy to
numpy==1.26.4and it worked.Your Environment
mypy.ini(and other config files): default