You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cannot implement an interface that extends another interface #1783
Operating System: Ubuntu 20.04.4 LTS (docker run --rm -it ubuntu:20.04)
.NET Runtime: .NET Core 6.0.202
Details
Describe what you were trying to get done.
Attempting to implement interfaces defined in .NET. Works fine for simple interfaces but I receive a weird error when the interface extends IDisposable
If there was a crash, please include the traceback here.
(venv) root@ca20f043eef5:/t# python demo.py
Dispose
Traceback (most recent call last):
File "demo.py", line 21, in <module>
class MyBuffer(System.Buffers.IMemoryOwner):
TypeError: Method 'Dispose' in type 'MyNamespace.MyBuffer' from assembly 'Python.Runtime.Dynamic, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
Can you try adding IDisposable explicitly to the list of MyBuffer bases? I wonder if it would work around the issue. (Still looks like a valid bug to me)
Tested this on Windows 10, Python 3.8.10, Pythonnet 3.0.0a2 using .NET Framework (removed the set_runtime() stuff, merely used import clr). Had to switch to System.ComponentModel.IComponent as System.Buffers.IMemoryOwner is not available there. I get the exact same error:
changed the title [-]Cannot implement an interface that extends IDisposable[/-][+]Cannot implement an interface that extends another interface[/+]on May 6, 2022
I do not believe this bug is a 3.0.0 blocker, as this probably never worked in 2.5 either. For 3.0.0 we should focus on regressions and breaking changes.
from enum import Enum
class SourceKey(str, Enum):
A = "a"
B = "b"
cannot use multiple inheritance with managed classes
During the algorithm initialization, the following exception has occurred:
Loader.TryCreatePythonAlgorithm(): Unable to import python module /somemodule/somepython.py.
AlgorithmPythonWrapper(): cannot use multiple inheritance with managed classes
at <module>
Activity
lostmsu commentedon May 5, 2022
Can you try adding
IDisposableexplicitly to the list ofMyBufferbases? I wonder if it would work around the issue. (Still looks like a valid bug to me)phxnsharp commentedon May 5, 2022
** Edited, I posted the wrong error originally
Thanks for the thought. Doesn't seem to be supported?
phxnsharp commentedon May 6, 2022
Tested this on Windows 10, Python 3.8.10, Pythonnet 3.0.0a2 using .NET Framework (removed the set_runtime() stuff, merely used
import clr). Had to switch to System.ComponentModel.IComponent as System.Buffers.IMemoryOwner is not available there. I get the exact same error:phxnsharp commentedon May 6, 2022
The error has nothing specifically to do with IDisposable. Any interface that extends a second interface shows this problem:
[-]Cannot implement an interface that extends IDisposable[/-][+]Cannot implement an interface that extends another interface[/+]lostmsu commentedon May 12, 2022
I do not believe this bug is a 3.0.0 blocker, as this probably never worked in 2.5 either. For 3.0.0 we should focus on regressions and breaking changes.
cordsmedia commentedon Feb 2, 2023
I'm seeing the same error with this for example: