Allow setting typed objects via PyModule.Set

Environment

  • Pythonnet version: 3.0.1
  • Python version: 3.11
  • Operating System: Windows 11
  • .NET Runtime: .NET 4.8

Details

  • Right now, a .NET object can be passed to the Python scripting engine via PyModule.Set, which internally calls ToPythonDetectType(value)
    We'd like to pass a certain interface that the object supports, so only methods of this interface are available for Python scripting.

I suspect that adding the overloaded method PyModule.Set or ConverterExtension.ToPython that accepts the type of the object may resolve this issue.