Skip to content

Commit ae93837

Browse files
committed
Fix crash when encountering match statement (#11749)
The crash only happens with compiled mypy on Python 3.10, I think.
1 parent 69dbb47 commit ae93837

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: mypy/fastparse.py

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

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

12921294

12931295
class TypeConverter:

0 commit comments

Comments
 (0)