Skip to content

Commit

Permalink
Fix crash when encountering match statement (#11749)
Browse files Browse the repository at this point in the history
The crash only happens with compiled mypy on Python 3.10, I think.
  • Loading branch information
JukkaL committed Dec 15, 2021
1 parent 69dbb47 commit ae93837
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mypy/fastparse.py
Expand Up @@ -1285,9 +1285,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:
Expand Down

0 comments on commit ae93837

Please sign in to comment.