Commit ece4d41
authored
fix: unpack unions inside tuples in except handlers (#17762)
Fixes #17759
mypy unpacks only top-level unions in except handlers, leaving unions
inside tuples unchanged. This leads to the failed check because the
Union type isn't a subtype of the BaseException type. We can fix this by
simplifying and unpacking types inside tuples.1 parent 4f5425e commit ece4d41
File tree
3 files changed
+62
-5
lines changed- mypy
- test-data/unit
3 files changed
+62
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5298 | 5298 | | |
5299 | 5299 | | |
5300 | 5300 | | |
5301 | | - | |
| 5301 | + | |
| 5302 | + | |
| 5303 | + | |
| 5304 | + | |
| 5305 | + | |
| 5306 | + | |
| 5307 | + | |
| 5308 | + | |
| 5309 | + | |
| 5310 | + | |
5302 | 5311 | | |
5303 | 5312 | | |
5304 | 5313 | | |
5305 | 5314 | | |
5306 | 5315 | | |
5307 | 5316 | | |
5308 | | - | |
5309 | | - | |
5310 | | - | |
5311 | 5317 | | |
5312 | 5318 | | |
5313 | 5319 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
801 | 801 | | |
802 | 802 | | |
803 | 803 | | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
804 | 855 | | |
805 | 856 | | |
806 | 857 | | |
| |||
0 commit comments