Commit a8edca6
authored
Currently, there are a few places where tp_mro could theoretically
become NULL, but do not in practice. This commit adds defensive checks for
NULL values to ensure that any changes do not introduce a crash and that
state invariants are upheld.
The assertions added in this commit are all instances where a NULL value would get passed to something not expecting a NULL, so it is better to catch an assertion failure than crash later on.
There are a few cases where it is OK for the return of lookup_tp_mro to be NULL, such as when passed to is_subtype_with_mro, which handles this explicitly.
1 parent 02c1abf commit a8edca6
1 file changed
+10
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1780 | 1780 | | |
1781 | 1781 | | |
1782 | 1782 | | |
1783 | | - | |
| 1783 | + | |
1784 | 1784 | | |
1785 | 1785 | | |
1786 | 1786 | | |
| |||
1791 | 1791 | | |
1792 | 1792 | | |
1793 | 1793 | | |
| 1794 | + | |
1794 | 1795 | | |
1795 | 1796 | | |
1796 | 1797 | | |
| |||
1835 | 1836 | | |
1836 | 1837 | | |
1837 | 1838 | | |
1838 | | - | |
| 1839 | + | |
1839 | 1840 | | |
1840 | 1841 | | |
1841 | 1842 | | |
| |||
1926 | 1927 | | |
1927 | 1928 | | |
1928 | 1929 | | |
1929 | | - | |
| 1930 | + | |
1930 | 1931 | | |
1931 | 1932 | | |
1932 | 1933 | | |
| |||
3432 | 3433 | | |
3433 | 3434 | | |
3434 | 3435 | | |
| 3436 | + | |
3435 | 3437 | | |
3436 | 3438 | | |
3437 | 3439 | | |
| |||
3466 | 3468 | | |
3467 | 3469 | | |
3468 | 3470 | | |
| 3471 | + | |
3469 | 3472 | | |
3470 | 3473 | | |
3471 | | - | |
| 3474 | + | |
| 3475 | + | |
| 3476 | + | |
3472 | 3477 | | |
3473 | 3478 | | |
3474 | 3479 | | |
| |||
8998 | 9003 | | |
8999 | 9004 | | |
9000 | 9005 | | |
| 9006 | + | |
9001 | 9007 | | |
9002 | 9008 | | |
9003 | 9009 | | |
| |||
0 commit comments