You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mypy crashed in a function of mine that uses match statement.
Traceback
$ mypy a.py --show-traceback
a.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.980+dev.92420469fddfb6b96b1e66ed8ab02ace550bc01c
Traceback (most recent call last):
File "/path/redacted/bin/mypy", line 8, in <module>
sys.exit(console_entry())
File "/path/redacted/lib/python3.10/site-packages/mypy/__main__.py", line 12, in console_entry
main(None, sys.stdout, sys.stderr)
File "/path/redacted/lib/python3.10/site-packages/mypy/main.py", line 94, in main
res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
File "/path/redacted/lib/python3.10/site-packages/mypy/main.py", line 173, in run_build
res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
File "/path/redacted/lib/python3.10/site-packages/mypy/build.py", line 189, in build
result = _build(
File "/path/redacted/lib/python3.10/site-packages/mypy/build.py", line 273, in _build
graph = dispatch(sources, manager, stdout)
File "/path/redacted/lib/python3.10/site-packages/mypy/build.py", line 2880, in dispatch
process_graph(graph, manager)
File "/path/redacted/lib/python3.10/site-packages/mypy/build.py", line 3264, in process_graph
process_stale_scc(graph, scc, manager)
File "/path/redacted/lib/python3.10/site-packages/mypy/build.py", line 3365, in process_stale_scc
graph[id].type_check_first_pass()
File "/path/redacted/lib/python3.10/site-packages/mypy/build.py", line 2308, in type_check_first_pass
self.type_checker().check_first_pass()
File "/path/redacted/lib/python3.10/site-packages/mypy/checker.py", line 460, in check_first_pass
self.accept(d)
File "/path/redacted/lib/python3.10/site-packages/mypy/checker.py", line 566, in accept
stmt.accept(self)
File "/path/redacted/lib/python3.10/site-packages/mypy/nodes.py", line 811, in accept
return visitor.visit_func_def(self)
File "/path/redacted/lib/python3.10/site-packages/mypy/checker.py", line 930, in visit_func_def
self._visit_func_def(defn)
File "/path/redacted/lib/python3.10/site-packages/mypy/checker.py", line 934, in _visit_func_def
self.check_func_item(defn, name=defn.name)
File "/path/redacted/lib/python3.10/site-packages/mypy/checker.py", line 1003, in check_func_item
self.check_func_def(defn, typ, name)
File "/path/redacted/lib/python3.10/site-packages/mypy/checker.py", line 1187, in check_func_def
self.accept(item.body)
File "/path/redacted/lib/python3.10/site-packages/mypy/checker.py", line 566, in accept
stmt.accept(self)
File "/path/redacted/lib/python3.10/site-packages/mypy/nodes.py", line 1201, in accept
return visitor.visit_block(self)
File "/path/redacted/lib/python3.10/site-packages/mypy/checker.py", line 2379, in visit_block
self.accept(s)
File "/path/redacted/lib/python3.10/site-packages/mypy/checker.py", line 566, in accept
stmt.accept(self)
File "/path/redacted/lib/python3.10/site-packages/mypy/nodes.py", line 1556, in accept
return visitor.visit_match_stmt(self)
File "/path/redacted/lib/python3.10/site-packages/mypy/checker.py", line 4433, in visit_match_stmt
pattern_types = [self.pattern_checker.accept(p, subject_type) for p in s.patterns]
File "/path/redacted/lib/python3.10/site-packages/mypy/checker.py", line 4433, in <listcomp>
pattern_types = [self.pattern_checker.accept(p, subject_type) for p in s.patterns]
File "/path/redacted/lib/python3.10/site-packages/mypy/checkpattern.py", line 119, in accept
result = o.accept(self)
File "/path/redacted/lib/python3.10/site-packages/mypy/patterns.py", line 90, in accept
return visitor.visit_sequence_pattern(self)
File "/path/redacted/lib/python3.10/site-packages/mypy/checkpattern.py", line 307, in visit_sequence_pattern
new_type = self.construct_sequence_child(current_type, new_inner_type)
File "/path/redacted/lib/python3.10/site-packages/mypy/checkpattern.py", line 651, in construct_sequence_child
types = [
File "/path/redacted/lib/python3.10/site-packages/mypy/checkpattern.py", line 652, in <listcomp>
self.construct_sequence_child(item, inner_type)
File "/path/redacted/lib/python3.10/site-packages/mypy/checkpattern.py", line 660, in construct_sequence_child
assert isinstance(proper_type, Instance)
AssertionError:
a.py:7: : note: use --pdb to drop into pdb
To Reproduce
Use mypy master and Python 3.10.4 to check the following file
from typing import Tuple, TypeAlias
MyType: TypeAlias = str | Tuple[str, str] | float
def test_fn(input: MyType) -> float:
match input:
case str():
return float(input)
case str(), str():
a, b = input
return float(a) - float(b)
case float():
return input
case _:
raise ValueError("Unexpected input type")
Your Environment
Mypy version used: 0.980+dev.92420469fddfb6b96b1e66ed8ab02ace550bc01c
Mypy command-line flags: None
Mypy configuration options from mypy.ini (and other config files): None
Python version used: 3.10.4
The text was updated successfully, but these errors were encountered:
Crash Report
mypy crashed in a function of mine that uses match statement.
Traceback
To Reproduce
Use mypy master and Python 3.10.4 to check the following file
Your Environment
mypy.ini
(and other config files): NoneThe text was updated successfully, but these errors were encountered: