You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At first sight this looks like another instance of
topic-join-v-unionUsing join vs. using unions
, but what's a little odd to me is that these classes have a common base, so shouldn't the join of the types be type[PKey], not type[Any]? It seems that mypy's join infers type for types with a common base that do not have the same constructor. Here's a self-contained example
classA:
x: intclassB(A):
def__init__(self, y: str) ->None: ...
classC(A):
passforxin (B, C):
reveal_type(x) # Revealed type is "builtins.type"
I can see why that is (otherwise it would be unsafe to instantiate pkey_class), but it was surprising to me.
Bug Report
paramiko keys have base class
PKey
which has a classmethodfrom_private_key
. When trying to call this on a subclass, mypy errors with:To Reproduce
Actual Behavior
See above. Changing the code to this passes with no error:
Your Environment
mypy.ini
(and other config files):The text was updated successfully, but these errors were encountered: