Commit 51c8d90
committed
Clear rejected overload probe errors when a method bind succeeds
MethodBinder probes each overload candidate with setError: false, but a
probe can still raise: the implicit-conversion catches in
Converter.ToManagedValue raise unconditionally so that Invoke can
surface the specific cause (e.g. a throwing implicit operator) as the
bind-failure reason instead of the generic no-match message.
When the raising candidate was probed after the candidate that
ultimately matched, nothing cleared the indicator before the method ran
and the otherwise successful call failed with "SystemError: ...
returned a result with an error set". Errors raised by earlier
candidates were incidentally wiped by the per-candidate
PyObject_Type/Exceptions.Clear type check, which is why the leak needs
this specific overload ordering: an exact-class-match overload
(precedence 40) binds first, then a string overload (precedence 50) is
probed and raises.
Clear any pending probe error in Bind once an overload has matched. The
bind-failure path is untouched, so a pending error is still surfaced as
the failure reason when nothing matches (ImplicitConversionErrorHandling).1 parent de1d156 commit 51c8d90
2 files changed
Lines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
| |||
180 | 182 | | |
181 | 183 | | |
182 | 184 | | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
183 | 201 | | |
184 | 202 | | |
185 | 203 | | |
| |||
1533 | 1551 | | |
1534 | 1552 | | |
1535 | 1553 | | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
1536 | 1564 | | |
1537 | 1565 | | |
1538 | 1566 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
792 | 792 | | |
793 | 793 | | |
794 | 794 | | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
795 | 803 | | |
796 | 804 | | |
797 | 805 | | |
| |||
0 commit comments