-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
bugmypy got something wrongmypy got something wrongtopic-type-narrowingConditional type narrowing / binderConditional type narrowing / binder
Description
In this example
def func(cls: type) -> typing.Any:
if cls is str:
reveal_type(cls)
return cls(5)mypy states
note: Revealed type is "builtins.type"
Makes sense. However, if I change it to
def func(cls: type) -> typing.Any:
if issubclass(cls, int):
pass
elif cls is str:
reveal_type(cls)
return cls(5)mypy states
note: Revealed type is "Type[builtins.object]"
error: Too many arguments for "object"
This is on Python 3.8.10 and mypy 0.910.
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-type-narrowingConditional type narrowing / binderConditional type narrowing / binder