File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -559,6 +559,11 @@ try:
559
559
except (E1, E2): pass
560
560
except (E1, object): pass # E: Exception type must be derived from BaseException
561
561
except (object, E2): pass # E: Exception type must be derived from BaseException
562
+ except (E1, (E2,)): pass # E: Exception type must be derived from BaseException
563
+
564
+ except (E1, E2): pass
565
+ except ((E1, E2)): pass
566
+ except (((E1, E2))): pass
562
567
[builtins fixtures/exception.py]
563
568
564
569
[case testExceptWithMultipleTypes2]
@@ -656,6 +661,10 @@ except exs2 as e2:
656
661
a = e2 # type: E1
657
662
b = e2 # type: E1_1 # E: Incompatible types in assignment (expression has type "Union[E1_1, E1_2]", variable has type "E1_1")
658
663
c = e2 # type: E1_2 # E: Incompatible types in assignment (expression has type "Union[E1_1, E1_2]", variable has type "E1_2")
664
+
665
+ exs3 = (E1, (E1_1, (E1_2,)))
666
+ try: pass
667
+ except exs3 as e3: pass # E: Exception type must be derived from BaseException
659
668
[builtins fixtures/exception.py]
660
669
661
670
[case testInvalidTupleValueAsExceptionType]
You can’t perform that action at this time.
0 commit comments