Skip to content

An overload with a parameter of type object is not used #811

@lostmsu

Description

@lostmsu

Environment

  • Pythonnet version: 2.3.0
  • Python version: 3.6
  • Operating System: Win 10 x64 1809

Details

I am trying to get Python call my C# method, which has a parameter of type object with an instance of Python's KeyError.

var o = overloaded.ToPython();

dynamic callWithSelf = PythonEngine.Eval("lambda o: o.ObjOrClass(KeyError())");
callWithSelf(o);

Where ObjOrClass definition is: public void ObjOrClass(object _) => this.Value = Object;. The actual function body here is not important.

  • Error:
Python.Runtime.PythonException : TypeError : No method matches given arguments for ObjOrClass

Possibly related:

#265
#782

Thoughs

IMHO, Python.NET should create a PyObject and pass it here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions