@@ -551,21 +551,20 @@ def check_sequence(tp_args, pattern_args):
551
551
return expand_and_check (type_ , self .pattern )
552
552
except TypeError as e :
553
553
# Special handling for MultiInputObjects (which are annoying)
554
- if isinstance (self .pattern , tuple ) and self .pattern [0 ] == MultiInputObj :
555
- # Attempt to coerce the object into arg type of the MultiInputObj first,
556
- # and if that fails, try to coerce it into a list of the arg type
557
- inner_type_parser = copy (self )
558
- inner_type_parser .pattern = self .pattern [1 ][0 ]
559
- try :
560
- inner_type_parser .check_type (type_ )
561
- except TypeError :
562
- add_exc_note (
563
- e ,
564
- "Also failed to coerce to the arg-type of the MultiInputObj "
565
- f"({ self .pattern [1 ][0 ]} )" ,
566
- )
567
- raise e
568
- else :
554
+ if not isinstance (self .pattern , tuple ) or self .pattern [0 ] != MultiInputObj :
555
+ raise e
556
+ # Attempt to coerce the object into arg type of the MultiInputObj first,
557
+ # and if that fails, try to coerce it into a list of the arg type
558
+ inner_type_parser = copy (self )
559
+ inner_type_parser .pattern = self .pattern [1 ][0 ]
560
+ try :
561
+ inner_type_parser .check_type (type_ )
562
+ except TypeError :
563
+ add_exc_note (
564
+ e ,
565
+ "Also failed to coerce to the arg-type of the MultiInputObj "
566
+ f"({ self .pattern [1 ][0 ]} )" ,
567
+ )
569
568
raise e
570
569
571
570
def check_coercible (self , source : ty .Any , target : ty .Union [type , ty .Any ]):
0 commit comments