Wrong method chosen if argument is passed as keyword argument

Environment

  • Pythonnet version: 2.5.0
  • Python version: 3.7
  • Operating System: Windows 10

Details

namespace Python.Test {
    public class MethodArityTest
    {
        public string Foo(int a) { return "Arity 1"; }
        public string Foo(int a, int b) { return "Arity 2"; }
    }
}
def test_keyword_arg_method_resolution():
    """Test correct method is chosen using keyword arguments"""
    from Python.Test import MethodArityTest

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

The test above fails with:

    def test_keyword_arg_method_resolution():
        """Test correct method is chosen using keyword arguments"""
        from Python.Test import MethodArityTest

        ob = MethodArityTest()
>       assert ob.Foo(1, b=2) == "Arity 2"
E       AssertionError: assert 'Arity 1' == 'Arity 2'
E         - Arity 1
E         ?       ^
E         + Arity 2
E         ?       ^