From eccde1812973ea4c8d86568f41a937c62fbeb2c2 Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Wed, 15 Dec 2021 09:31:41 +0000 Subject: [PATCH] Fix crash when encountering match statement The crash only happens with compiled mypy on Python 3.10, I think. --- mypy/fastparse.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mypy/fastparse.py b/mypy/fastparse.py index bd348e6a0237..34fe2c0da32d 100644 --- a/mypy/fastparse.py +++ b/mypy/fastparse.py @@ -1286,9 +1286,11 @@ def visit_Index(self, n: Index) -> Node: # cast for mypyc's benefit on Python 3.9 return self.visit(cast(Any, n).value) - def visit_Match(self, n: Any) -> None: + def visit_Match(self, n: Any) -> Node: self.fail("Match statement is not supported", line=n.lineno, column=n.col_offset, blocker=True) + # Just return some valid node + return PassStmt() class TypeConverter: