Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions mypy/typeops.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,6 @@ def class_callable(
variables.extend(info.defn.type_vars)
variables.extend(init_type.variables)

from mypy.subtypes import is_subtype

init_ret_type = get_proper_type(init_type.ret_type)
orig_self_type = get_proper_type(orig_self_type)
default_ret_type = fill_typevars(info)
Expand All @@ -187,9 +185,6 @@ def class_callable(
# by accident. Like `Hashable` is a subtype of `object`. See #11799
and isinstance(default_ret_type, Instance)
and not default_ret_type.type.is_protocol
# Only use the declared return type from __new__ or declared self in __init__
# if it is actually returning a subtype of what we would return otherwise.
and is_subtype(explicit_type, default_ret_type, ignore_type_params=True)
):
ret_type: Type = explicit_type
else:
Expand Down