-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
bugmypy got something wrongmypy got something wrongtopic-type-narrowingConditional type narrowing / binderConditional type narrowing / binder
Description
Consider the following (contrived) code:
from typing import Type
def untyped_function():
return int
def foo() -> Type[int]:
x = untyped_function()
assert issubclass(x, int)
return xRunning mypy on this with the --warn-return-any option produces the error "Returning Any from function declared to return "Type[int]"", even though the assert issubclass should convince mypy that x is of type Type[int] and not an Any.
Your Environment
- Mypy version used: 0.902
- Mypy command-line flags:
--warn-return-any - Mypy configuration options from
mypy.ini(and other config files): none - Python version used: Python 3.9.5
- Operating system and version: macOS 11.3.1
dave-vkveretennicov
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-type-narrowingConditional type narrowing / binderConditional type narrowing / binder