Implement PEP-487: customisation of class creation
See original GitHub issueclass 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?
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (2 by maintainers)
Top Results From Across the Web
PEP 487 – Simpler customisation of class creation
Currently, customising class creation requires the use of a custom metaclass. This custom metaclass then persists for the entire lifecycle of the class, ......
Read more >[Python-Dev] PEP487: Simpler customization of class creation
While implementing PEP 487 I realized that there is and oddity in the type base class: type.__init__ forbids to use keyword arguments, even...
Read more >PEP 487: Customizing Class Creation - Real-world examples
I'm fairly intermediate with Python (been using it about 2ish years now for mainly data-related tasks). Ever since the introduction of PEP ......
Read more >Re: [Python-Dev] PEP487: Simpler customization of class creation ...
In any case I find this PEP great. If we can implement a library like traitlets only using these new hooks without a...
Read more >pep487 - PyPI
PEP487 - Simpler customisation of class creation. ... from pep487 import PEP487Object >>> class FooBase(PEP487Object): ... foos = set() ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t really know how I fixed it but its fixed now…
I don’t know what is going on now, but the error is still there. Here is the build: https://ci.appveyor.com/project/rayzchen/pyunity/build/job/i011xbqufc0tj03o
Lines 39-533 are the main focus. Line 39 installs cython 3.0a8, line 57 creates the cython files (using
cythonize -3 -q file.py
) and the rest is just creating the bdist. However, when I install the wheel provided (tested on both python 3.9 win32 and win_amd64) and run an example, the error happens when subclassing frompyunity.Behaviour
, which defines__init_subclass__
. But for some reason, it works randomly on another computer that I have open. I really am too confused right now.