| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b5ba815 commit d44f1da
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,6 +22,7 @@ details about the cause of the failure | |||
| 22 | 22 | - Fix incorrect dereference in params array handling | |
| 23 | 23 | - Fix `object[]` parameters taking precedence when should not in overload resolution | |
| 24 | 24 | - Fixed a bug where all .NET class instances were considered Iterable | |
| 25 | + - Fix incorrect choice of method to invoke when using keyword arguments. | ||
| 25 | 26 | ||
| 26 | 27 | ## [2.5.0][] - 2020-06-14 | |
| 27 | 28 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -89,7 +89,7 @@ internal object InvokeRaw(IntPtr inst, IntPtr args, IntPtr kw, MethodBase info) | |||
| 89 | 89 | // any extra args are intended for the subclass' __init__. | |
| 90 | 90 | ||
| 91 | 91 | IntPtr eargs = Runtime.PyTuple_New(0); | |
| 92 | - binding = Bind(inst, eargs, kw); | ||
| 92 | + binding = Bind(inst, eargs, IntPtr.Zero); | ||
| 93 | 93 | Runtime.XDecref(eargs); | |
| 94 | 94 | ||
| 95 | 95 | if (binding == null) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -580,7 +580,7 @@ static bool MatchesArgumentCount(int positionalArgumentCount, ParameterInfo[] pa | |||
| 580 | 580 | var match = false; | |
| 581 | 581 | paramsArray = parameters.Length > 0 ? Attribute.IsDefined(parameters[parameters.Length - 1], typeof(ParamArrayAttribute)) : false; | |
| 582 | 582 | ||
| 583 | - if (positionalArgumentCount == parameters.Length) | ||
| 583 | + if (positionalArgumentCount == parameters.Length && kwargDict.Count == 0) | ||
| 584 | 584 | { | |
| 585 | 585 | match = true; | |
| 586 | 586 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -699,6 +699,12 @@ public string PublicMethod(string echo) | |||
| 699 | 699 | return echo; | |
| 700 | 700 | } | |
| 701 | 701 | } | |
| 702 | + | ||
| 703 | + public class MethodArityTest | ||
| 704 | + { | ||
| 705 | + public string Foo(int a) { return "Arity 1"; } | ||
| 706 | + public string Foo(int a, int b) { return "Arity 2"; } | ||
| 707 | + } | ||
| 702 | 708 | } | |
| 703 | 709 | ||
| 704 | 710 | namespace PlainOldNamespace | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1149,3 +1149,10 @@ def test_optional_and_default_params(): | |||
| 1149 | 1149 | ||
| 1150 | 1150 | res = MethodTest.OptionalAndDefaultParams2(b=2, c=3) | |
| 1151 | 1151 | assert res == "0232" | |
| 1152 | + | ||
| 1153 | + def test_keyword_arg_method_resolution(): | ||
| 1154 | + from Python.Test import MethodArityTest | ||
| 1155 | + | ||
| 1156 | + ob = MethodArityTest() | ||
| 1157 | + assert ob.Foo(1, b=2) == "Arity 2" | ||
| 1158 | + | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments