Commit 0d6f9af
Fix IndexOutOfRangeException on empty **kwargs call to overloaded method (#132)
Calling an overloaded method with an empty kwargs mapping (e.g.
obj.Method(arg, **{}), common when forwarding *args/**kwargs from a
wrapper) crashed with an unhandled IndexOutOfRangeException in
MethodBinder.CheckMethodArgumentsMatch. Since 10e721b (PR #83), the
parameter names array is only populated when there are named arguments,
but the kwargs code paths only checked the kwargs dictionary for null,
so a non-null empty dict indexed into an empty names array.
Treat an empty kwargs dict as no keyword arguments, matching Python
semantics where f(x, **{}) is equivalent to f(x).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent 66dc277 commit 0d6f9af
2 files changed
Lines changed: 53 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
814 | 814 | | |
815 | 815 | | |
816 | 816 | | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
817 | 834 | | |
818 | 835 | | |
819 | 836 | | |
| |||
895 | 912 | | |
896 | 913 | | |
897 | 914 | | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
898 | 944 | | |
899 | 945 | | |
900 | 946 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
478 | | - | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
479 | 482 | | |
480 | | - | |
| 483 | + | |
| 484 | + | |
481 | 485 | | |
482 | | - | |
483 | 486 | | |
484 | 487 | | |
485 | 488 | | |
| |||
490 | 493 | | |
491 | 494 | | |
492 | 495 | | |
493 | | - | |
| 496 | + | |
494 | 497 | | |
495 | 498 | | |
496 | 499 | | |
| |||
0 commit comments