@@ -819,7 +819,7 @@ def type_object_type(info: TypeInfo, builtin_type: Callable[[str], Instance]) ->
819
819
arg_names = ["_args" , "_kwds" ],
820
820
ret_type = any_type ,
821
821
fallback = builtin_type ('builtins.function' ))
822
- return class_callable (sig , info , fallback , None )
822
+ return class_callable (sig , info , fallback , None , is_new = False )
823
823
824
824
# Otherwise prefer __init__ in a tie. It isn't clear that this
825
825
# is the right thing, but __new__ caused problems with
@@ -884,13 +884,12 @@ def type_object_type_from_function(signature: FunctionLike,
884
884
885
885
def class_callable (init_type : CallableType , info : TypeInfo , type_type : Instance ,
886
886
special_sig : Optional [str ],
887
- is_new : bool = False ) -> CallableType :
887
+ is_new : bool ) -> CallableType :
888
888
"""Create a type object type based on the signature of __init__."""
889
889
variables = [] # type: List[TypeVarDef]
890
890
variables .extend (info .defn .type_vars )
891
891
variables .extend (init_type .variables )
892
892
893
- is_new = True
894
893
if is_new and isinstance (init_type .ret_type , (Instance , TupleType )):
895
894
ret_type = init_type .ret_type # type: Type
896
895
else :
0 commit comments