Skip to content

Commit bec22c3

Browse files
committed
Allow Type in isinstance
1 parent 0f06e06 commit bec22c3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mypy/checker.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2789,7 +2789,8 @@ def get_isinstance_type(expr: Expression, type_map: Dict[Expression, Type]) -> L
27892789
# Type[A] means "any type that is a subtype of A" rather than "precisely type A"
27902790
# we indicate this by setting is_upper_bound flag
27912791
types.append(TypeRange(type.item, is_upper_bound=True))
2792-
elif isinstance(type, Instance) and type.type.fullname() == 'builtins.type':
2792+
elif isinstance(type, Instance):
2793+
# type and Type will end up in this branch
27932794
object_type = Instance(type.type.mro[-1], [])
27942795
types.append(TypeRange(object_type, is_upper_bound=True))
27952796
else: # we didn't see an actual type, but rather a variable whose value is unknown to us

0 commit comments

Comments
 (0)