Commit 6606dbe
committed
Allow non-final __match_args__ and overriding (#12415)
Allow subclasses to override `__match_args__` freely, and don't require
`__match_args__` to be final.
This matches runtime behavior. For example, if `B` subclasses `A`,
`case A(...)` also matches instances of `B`, using the `__match_args__`
from `A`.
The issue was brough up by @AlexWaygood in
#12411 (comment).1 parent 626147a commit 6606dbe
File tree
3 files changed
+47
-11
lines changed- mypy
- test-data/unit
3 files changed
+47
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1439 | 1439 | | |
1440 | 1440 | | |
1441 | 1441 | | |
1442 | | - | |
1443 | | - | |
1444 | | - | |
1445 | | - | |
1446 | | - | |
1447 | | - | |
| 1442 | + | |
1448 | 1443 | | |
1449 | 1444 | | |
1450 | 1445 | | |
| |||
2276 | 2271 | | |
2277 | 2272 | | |
2278 | 2273 | | |
2279 | | - | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
2280 | 2277 | | |
2281 | 2278 | | |
2282 | 2279 | | |
2283 | 2280 | | |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
2284 | 2284 | | |
2285 | 2285 | | |
2286 | 2286 | | |
| |||
2377 | 2377 | | |
2378 | 2378 | | |
2379 | 2379 | | |
2380 | | - | |
| 2380 | + | |
| 2381 | + | |
2381 | 2382 | | |
2382 | 2383 | | |
2383 | 2384 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
| 248 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
881 | 881 | | |
882 | 882 | | |
883 | 883 | | |
884 | | - | |
| 884 | + | |
885 | 885 | | |
886 | 886 | | |
887 | 887 | | |
888 | 888 | | |
889 | 889 | | |
890 | 890 | | |
891 | 891 | | |
892 | | - | |
893 | | - | |
| 892 | + | |
| 893 | + | |
894 | 894 | | |
895 | 895 | | |
896 | 896 | | |
| |||
1528 | 1528 | | |
1529 | 1529 | | |
1530 | 1530 | | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
0 commit comments