Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ details about the cause of the failure
- Fix incorrect dereference in params array handling
- Fix `object[]` parameters taking precedence when should not in overload resolution
- Fixed a bug where all .NET class instances were considered Iterable
- Fix incorrect choice of method to invoke when using keyword arguments.

## [2.5.0][] - 2020-06-14

Expand Down
2 changes: 1 addition & 1 deletion 2 src/runtime/constructorbinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ internal object InvokeRaw(IntPtr inst, IntPtr args, IntPtr kw, MethodBase info)
// any extra args are intended for the subclass' __init__.

IntPtr eargs = Runtime.PyTuple_New(0);
binding = Bind(inst, eargs, kw);
binding = Bind(inst, eargs, IntPtr.Zero);
filmor marked this conversation as resolved.
Show resolved Hide resolved
Runtime.XDecref(eargs);

if (binding == null)
Expand Down
2 changes: 1 addition & 1 deletion 2 src/runtime/methodbinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ static bool MatchesArgumentCount(int positionalArgumentCount, ParameterInfo[] pa
var match = false;
paramsArray = parameters.Length > 0 ? Attribute.IsDefined(parameters[parameters.Length - 1], typeof(ParamArrayAttribute)) : false;

if (positionalArgumentCount == parameters.Length)
if (positionalArgumentCount == parameters.Length && kwargDict.Count == 0)
{
match = true;
}
Expand Down
6 changes: 6 additions & 0 deletions 6 src/testing/methodtest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,12 @@ public string PublicMethod(string echo)
return echo;
}
}

public class MethodArityTest
{
public string Foo(int a) { return "Arity 1"; }
public string Foo(int a, int b) { return "Arity 2"; }
}
}

namespace PlainOldNamespace
Expand Down
7 changes: 7 additions & 0 deletions 7 src/tests/test_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -1149,3 +1149,10 @@ def test_optional_and_default_params():

res = MethodTest.OptionalAndDefaultParams2(b=2, c=3)
assert res == "0232"

def test_keyword_arg_method_resolution():
from Python.Test import MethodArityTest

ob = MethodArityTest()
assert ob.Foo(1, b=2) == "Arity 2"

Morty Proxy This is a proxified and sanitized view of the page, visit original site.