- Notifications
You must be signed in to change notification settings - Fork749
Description
Environment
- Pythonnet version: 3.0+
- Python version: any
- Operating System: any
- .NET Runtime: any
tldr;
#1240 changes the behavior of pythonnet to wrap only the interface methods/members of objects returned by a .NET method whose method declaration states that it returns an interface. Prior to this change, the python object that pythonnet created for the return object wrapped the returned object instance, but did not necessarily implement the interface. The prior behavior was useful for idiomatic C# patterns like the factory pattern.
This wasdiscussed on the mailing list and I wanted to file an issue here.
Apparently, the change was also reverted in theQuantConnect fork.
My preferred fix, for what its worth, is option 4 (from the list of options mentioned by Victor in that thread):
IronPython apparently allows explicit interface implementations to be called (instead of returning interface-wrapped instances), if there’s no conflict with regular methods. Perhaps we should consider this as an option.