From c0ec3aa9e3935d8761dab8217ab7d849254b68d8 Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Wed, 15 Dec 2021 10:37:43 +0000 Subject: [PATCH] Fix crash when encountering match statement (#11749) 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: