Skip to content

Commit bb4b534

Browse files
authored
Fix self-check when targeting Python 3.10 (#12020)
This should fix wheel builds. Our CI always targets Python 3.6 when doing a self check, which means that we won't catch issues specific to more recent Python versions.
1 parent 0a03ba0 commit bb4b534

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mypy/fastparse.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ def ast3_parse(source: Union[str, bytes], filename: str, mode: str,
123123
MatchClass = ast3.MatchClass
124124
MatchAs = ast3.MatchAs
125125
MatchOr = ast3.MatchOr
126+
AstNode = Union[ast3.expr, ast3.stmt, ast3.pattern, ast3.ExceptHandler]
126127
else:
127128
Match = Any
128129
MatchValue = Any
@@ -133,6 +134,7 @@ def ast3_parse(source: Union[str, bytes], filename: str, mode: str,
133134
MatchClass = Any
134135
MatchAs = Any
135136
MatchOr = Any
137+
AstNode = Union[ast3.expr, ast3.stmt, ast3.ExceptHandler]
136138
except ImportError:
137139
try:
138140
from typed_ast import ast35 # type: ignore[attr-defined] # noqa: F401
@@ -357,7 +359,7 @@ def visit(self, node: Optional[AST]) -> Any:
357359
self.visitor_cache[typeobj] = visitor
358360
return visitor(node)
359361

360-
def set_line(self, node: N, n: Union[ast3.expr, ast3.stmt, ast3.ExceptHandler]) -> N:
362+
def set_line(self, node: N, n: AstNode) -> N:
361363
node.line = n.lineno
362364
node.column = n.col_offset
363365
node.end_line = getattr(n, "end_lineno", None) if isinstance(n, ast3.expr) else None

0 commit comments

Comments
 (0)