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
Exception when deriving from a .NET class with abstract methods in Python #2571
I have an abstract .NET class, which has abstract methods to override within a netstandard2.0 library. When I try to derive from such a class in Python, it throws a TypeError during class object creation.
Traceback (most recent call last):
File "<redacted>\crl_test.py", line 10, in <module>
class SubTestClass(TestClass):
TypeError: Method 'Bar' in type 'CrlTest.SubTestClass' from assembly 'Python.Runtime.Dynamic, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
After some further testing, it looks like it is specifically the method being protected abstract. If it is public abstract, as with an interface, then it works fine.
Looks like this is, actually, a duplicate of #2192, though having protected abstract methods makes the issue more annoying...
For now I've forked it with a tweak to allow overriding protected methods. The downside is that all protected methods get automatically wrapped into public ones in Python, though, on the other hand, since Python doesn't differentiate between the two, it doesn't seem like a big deal...
Activity
Eswcvlad commentedon Apr 3, 2025
After some further testing, it looks like it is specifically the method being
protected abstract. If it ispublic abstract, as with an interface, then it works fine.Eswcvlad commentedon Apr 8, 2025
Looks like this is, actually, a duplicate of #2192, though having
protected abstractmethods makes the issue more annoying...For now I've forked it with a tweak to allow overriding protected methods. The downside is that all
protectedmethods get automatically wrapped intopublicones in Python, though, on the other hand, since Python doesn't differentiate between the two, it doesn't seem like a big deal...Make AbstractPdfDocumentEventHandler usable