Skip to content

Commit a2c318b

Browse files
committed
SQ -> WIP: Don't declare attributes on Expression to avoid confusing mypyc
Fix: Workaround mypy thinking incorrectly that isinstance(X, Union[...]) does not work at runtime.
1 parent 9df0e6b commit a2c318b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mypy/nodes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2151,7 +2151,7 @@ def accept(self, visitor: ExpressionVisitor[T]) -> T:
21512151
# Expression subtypes that could represent the root of a valid type expression.
21522152
# Always contains an "as_type" attribute.
21532153
# TODO: Make this into a Protocol if mypyc is OK with that.
2154-
MaybeTypeExpression = Union[IndexExpr, NameExpr, OpExpr, StrExpr]
2154+
MaybeTypeExpression = (IndexExpr, NameExpr, OpExpr, StrExpr)
21552155

21562156

21572157
class ComparisonExpr(Expression):

0 commit comments

Comments
 (0)