Skip to content

Implement PEP-487: customisation of class creation #2781

@fduxiao

Description

@fduxiao
class ABC:
    def __init_subclass__(cls):
        print(cls)


class SubClass(ABC):
    pass

If you run this with python directly, it gives:

<class '__main__.SubClass'>

But after I compile it with cython, it gives:

TypeError                                 Traceback (most recent call last)
<ipython-input-1-a0954f22e2a4> in <module>
----> 1 import test

test.pyx in init test()

TypeError: __init_subclass__() takes exactly one argument (0 given)

How to solve it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions