Skip to content

Cannot inherit interfaces that inherit from interfaces with methods #2524

@sean-anderson-seco

Description

@sean-anderson-seco

Environment

  • Pythonnet version: 3.0.4
  • Python version: 3.8.10
  • Operating System: Ubuntu 2020.04
  • .NET Runtime: Mono JIT compiler version 6.8.0.105 (Debian 6.8.0.105+dfsg-2 Wed Feb 26 23:23:50 UTC 2020)

Details

Python classes cannot inherit from C# interfaces that themselves inherit from C# interfaces with methods:

namespace A
{
    public interface B
    {
        void C();
    }

    public interface D : B
    {
    }
}
import clr

clr.AddReference('A')
import A

class E(A.D):
    __namespace__ = 'F'

Output:

Traceback (most recent call last):
  File "<stdin>", line 6, in <module>
TypeError: Failed to create Python type for F.E

Extending from B works. It also works if C is removed from B.

Possibly related to #2511. Reverting to 3.0.3 (before 9ebfbde) provides the moderately-more-useful error TypeError: VTable setup of type F.E failed.

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