Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Classes without __namespace__ cannot be used for reflection #1774

Open
@rmadsen-ks

Description

@rmadsen-ks

Environment

  • Pythonnet version: 3.0.0-preview2022-04-11
  • Python version: 3.10
  • Operating System: MacOS
  • .NET Runtime: .net 6

Details

My software does lots of reflection on "plugin" types. Simply inheriting from a specific type is enough in C#, but when I use python.net I also have to define__namespace__. Since my users generally have the namespace being ., there is no logic reason for them to have to do this.

I can see which part of the code causes this:

// from MetaType.cs:133 (git: 7247da55c174be1b733e5f9fc4e1c356f6c42dc4)if(clsDict.HasKey("__assembly__")||clsDict.HasKey("__namespace__")){returnTypeManager.CreateSubType(name,base_type,clsDict);}

I am wonder if we could broaden the cases where TypeManager.CreateSubType is used. For example in cases where the super class is a type created with CreateSubType, or just any .NET class in general. Maybe it could also be if the super class implements a specific interface.

_TODO_

Add a way to not have to specifynamespace in the class in order for reflection to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp