@@ -423,13 +423,13 @@ def __new__(cls, *args, **kwargs):
423
423
raise TypeError ("Callable must be used as "
424
424
"Callable[[arg, ...], result]." )
425
425
_typ , _args = args
426
- if not isinstance (_args , (tuple , type (...) )) or len (_args ) != 2 :
426
+ if not isinstance (_args , (tuple , types . EllipsisType )) or len (_args ) != 2 :
427
427
raise TypeError ("Callable must be used as "
428
428
"Callable[[arg, ...], result]." )
429
429
t_args , t_result = _args
430
- if not isinstance (t_args , (list , type (...) )):
431
- raise TypeError ("Callable must be used as "
432
- "Callable[[arg, ...], result]. " )
430
+ if not isinstance (t_args , (list , types . EllipsisType )):
431
+ raise TypeError ("Callable[args, result]: args must be a list. Got "
432
+ f" { _type_repr ( t_args ) } " )
433
433
434
434
ga_args = []
435
435
for arg in args [1 ]:
@@ -459,7 +459,7 @@ def __repr__(self):
459
459
args = f"{ ', ' .join (_type_repr (a ) for a in t_args )} "
460
460
result = _type_repr (t_result )
461
461
462
- if not isinstance (t_args [0 ], type (...) ):
462
+ if not isinstance (t_args [0 ], types . EllipsisType ):
463
463
args = f"[{ args } ]"
464
464
465
465
return f"{ orig } [{ args } , { result } ]"
0 commit comments