-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrongfalse-positivemypy gave an error on correct codemypy gave an error on correct codepriority-0-high
Description
The type(t) is not M check should not narrow the type of t, since a subclass can have the metaclass:
from typing import Type
class M(type):
pass
class C: pass
class D(C, metaclass=M): pass
def f(t: Type[C]) -> None:
if type(t) is not M:
return
reveal_type(t) # <nothing>
f(D)I'd expect that the revealed type to be Type[C], not <nothing>. The latter can cause false positives.
This is a regression from mypy 0.812.
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongfalse-positivemypy gave an error on correct codemypy gave an error on correct codepriority-0-high