Skip to content

Commit 9e34f6a

Browse files
authored
Fix crash when encountering match statement (#11749)
The crash only happens with compiled mypy on Python 3.10, I think.
1 parent 602e890 commit 9e34f6a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mypy/fastparse.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1286,9 +1286,11 @@ def visit_Index(self, n: Index) -> Node:
12861286
# cast for mypyc's benefit on Python 3.9
12871287
return self.visit(cast(Any, n).value)
12881288

1289-
def visit_Match(self, n: Any) -> None:
1289+
def visit_Match(self, n: Any) -> Node:
12901290
self.fail("Match statement is not supported",
12911291
line=n.lineno, column=n.col_offset, blocker=True)
1292+
# Just return some valid node
1293+
return PassStmt()
12921294

12931295

12941296
class TypeConverter:

0 commit comments

Comments
 (0)