Repository navigation
Commit 4a2e333
committed
Type Tree.__rtruediv__ as uncallable in the stub
The stub declared __rtruediv__(other: str) -> Tree | Blob, so mypy
accepted "x / tree" even though reflected tree division always raises
TypeError at runtime: CPython synthesizes the wrapper from the single
nb_true_divide slot with the operands swapped, and Tree_divide returns
NotImplemented for a non-Tree left operand (issue #1505).
Declare it (self, other: Never, /) -> NotImplementedType instead, the
closest approximation of the real behavior: no argument is acceptable,
and the wrapper only ever returns NotImplemented.
Also fix the stale config path in the mypy-stubtest.ini usage comment.
Assisted-by: Kimi (Kimi Code)1 parent 01c1743 commit 4a2e333
2 files changed
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
844 | 846 | | |
845 | 847 | | |
846 | 848 | | |
847 | | - | |
| 849 | + | |
848 | 850 | | |
849 | 851 | | |
850 | 852 | | |
| |||
0 commit comments