-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
Description
Crash Report
Running mypy on the following source code results in the following crash with the following traceback.
Traceback
bug.py:7: 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: 0.990+dev.a3a5d73f7407f9565abcfd04689870e7c992f833
Traceback (most recent call last):
File "/home/harrison/.local/bin/mypy", line 8, in <module>
sys.exit(console_entry())
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/__main__.py", line 15, in console_entry
main()
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/main.py", line 95, in main
res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/main.py", line 174, in run_build
res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/build.py", line 193, in build
result = _build(
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/build.py", line 276, in _build
graph = dispatch(sources, manager, stdout)
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/build.py", line 2890, in dispatch
process_graph(graph, manager)
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/build.py", line 3274, in process_graph
process_stale_scc(graph, scc, manager)
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/build.py", line 3375, in process_stale_scc
graph[id].type_check_first_pass()
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/build.py", line 2307, in type_check_first_pass
self.type_checker().check_first_pass()
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/checker.py", line 462, in check_first_pass
self.accept(d)
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/checker.py", line 570, in accept
stmt.accept(self)
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/nodes.py", line 810, in accept
return visitor.visit_func_def(self)
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/checker.py", line 935, in visit_func_def
self._visit_func_def(defn)
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/checker.py", line 939, in _visit_func_def
self.check_func_item(defn, name=defn.name)
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/checker.py", line 1003, in check_func_item
self.check_func_def(defn, typ, name)
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/checker.py", line 1023, in check_func_def
expanded = self.expand_typevars(defn, typ)
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/checker.py", line 1656, in expand_typevars
result.append((expand_func(defn, mapping), expanded))
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/checker.py", line 6661, in expand_func
ret = visitor.node(defn)
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/treetransform.py", line 618, in node
new = node.accept(self)
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/nodes.py", line 810, in accept
return visitor.visit_func_def(self)
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/treetransform.py", line 182, in visit_func_def
self.block(node.body),
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/treetransform.py", line 651, in block
new = self.visit_block(block)
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/treetransform.py", line 264, in visit_block
return Block(self.statements(node.body))
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/treetransform.py", line 662, in statements
return [self.stmt(stmt) for stmt in statements]
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/treetransform.py", line 662, in <listcomp>
return [self.stmt(stmt) for stmt in statements]
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/treetransform.py", line 635, in stmt
new = stmt.accept(self)
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/nodes.py", line 1377, in accept
return visitor.visit_for_stmt(self)
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/treetransform.py", line 327, in visit_for_stmt
self.block(node.body),
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/treetransform.py", line 651, in block
new = self.visit_block(block)
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/treetransform.py", line 264, in visit_block
return Block(self.statements(node.body))
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/treetransform.py", line 662, in statements
return [self.stmt(stmt) for stmt in statements]
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/treetransform.py", line 662, in <listcomp>
return [self.stmt(stmt) for stmt in statements]
File "/home/harrison/.local/lib/python3.10/site-packages/mypy/treetransform.py", line 636, in stmt
assert isinstance(new, Statement)
AssertionError:
bug.py:7: : note: use --pdb to drop into pdb
To Reproduce
Run mypy on the following file.
from collections.abc import Iterable
from typing import TypeVar
S = TypeVar("S", int, str)
def my_func(pairs: Iterable[tuple[S, S]]) -> None:
for pair in pairs:
match pair:
# # Some dummy function
# case (int(x), int(y)):
# print(x + y)
# # Some dummy function
# case (str(x), str(y)):
# print(x[0] + y[-1])
case _:
raise ValueError(pair)
Your Environment
- Mypy version used:
mypy 0.990+dev.a3a5d73f7407f9565abcfd04689870e7c992f833 (compiled: no) - Mypy command-line flags:
--show-traceback --no-incremental - Mypy configuration options from
mypy.ini(and other config files): None - Python version used:
Python 3.10.7 - Operating system and version: Arch,
5.19.7-arch1-1