Thanks to visit codestin.com
Credit goes to github.com

Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Cannot inherit interfaces that inherit from interfaces with methods #2524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sean-anderson-seco opened this issue Dec 6, 2024 · 0 comments
Closed

Comments

@sean-anderson-seco
Copy link

sean-anderson-seco commented Dec 6, 2024

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.

@pythonnet pythonnet locked and limited conversation to collaborators Dec 7, 2024
@lostmsu lostmsu converted this issue into discussion #2525 Dec 7, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant