-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
Description
Crash Report
this could be related to #15927, but that ticket is related to python 3.10; mine is specific to python 3.13's new TypeVar(..., default=...) argument (the default argument is why i chose python 3.13 for my project 😃).
the minimal example below in the appropriate section uses TypeVar and Generic and produces a crash. i saw the traceback requesting that i try again on the main branch, pulled the main branch and tried again, and the traceback occurred again. so here it is!
Specifically, to get the mypy main branch, i did git clone, then from inside my project i did poetry add ../../mypy
Traceback
$ poetry run mypy --strict --show-traceback craftgrid/game_node.py
craftgrid/game_node.py:4: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 1.12.0+dev.fe15ee69b9225f808f8ed735671b73c31ae1bed8
Traceback (most recent call last):
File "/home/violet/git/violet/games/craftgrid/py/.venv/bin/mypy", line 8, in <module>
sys.exit(console_entry())
File "/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/__main__.py", line 15, in console_entry
main()
File "/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/main.py", line 102, in main
res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
File "/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/main.py", line 186, in run_build
res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
File "/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/build.py", line 193, in build
result = _build(
File "/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/build.py", line 268, in _build
graph = dispatch(sources, manager, stdout)
File "/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/build.py", line 2950, in dispatch
process_graph(graph, manager)
File "/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/build.py", line 3348, in process_graph
process_stale_scc(graph, scc, manager)
File "/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/build.py", line 3443, in process_stale_scc
mypy.semanal_main.semantic_analysis_for_scc(graph, scc, manager.errors)
File "/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/semanal_main.py", line 93, in semantic_analysis_for_scc
process_top_levels(graph, scc, patches)
File "/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/semanal_main.py", line 220, in process_top_levels
deferred, incomplete, progress = semantic_analyze_target(
File "/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/semanal_main.py", line 351, in semantic_analyze_target
analyzer.refresh_partial(
File "/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/semanal.py", line 619, in refresh_partial
self.refresh_top_level(node)
File "/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/semanal.py", line 630, in refresh_top_level
self.accept(d)
File "/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/semanal.py", line 7087, in accept
node.accept(self)
~~~~~~~~~~~^^^^^^
File "/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/nodes.py", line 1183, in accept
return visitor.visit_class_def(self)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/semanal.py", line 1700, in visit_class_def
self.analyze_class(defn)
~~~~~~~~~~~~~~~~~~^^^^^^
File "/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/semanal.py", line 1828, in analyze_class
self.defer()
~~~~~~~~~~^^
File "/home/violet/git/violet/games/craftgrid/py/.venv/lib/python3.13/site-packages/mypy/semanal.py", line 6742, in defer
assert not self.final_iteration, "Must not defer during final iteration"
^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Must not defer during final iteration
craftgrid/game_node.py:4: : note: use --pdb to drop into pdb
To Reproduce
from typing import TypeVar, Generic
class GameNode(Generic['GameNodeType']):
pass
GameNodeType = TypeVar('GameNodeType', bound=GameNode, default=GameNode)Your Environment
- Mypy version used: newest from main branch as of right now,
1.12.0+dev.fe15ee69b9225f808f8ed735671b73c31ae1bed8 - Mypy command-line flags:
poetry run mypy --strict --show-traceback craftgrid/game_node.py - Mypy configuration options from
mypy.ini(and other config files): - Python version used:
3.13.0rc1 - Operating system and version:
6.6.41-gentoo-dist