Since there is a discussion about the limited API and headers. A long
time ago I asked about this on python-dev:
It concerns me a bit that the limited API does not seem to support
MetaClasses in PyType_FromSpec (or FromSpecWithBase).
In particular, last time I checked, it seemed impossible to extend the
type struct within such a metaclass .
There also seemed to be an issue with PyType_FromSpecWithBases
allocating exactly a base type-object, instead of using `tp_alloc` as
This and how to efficiently cache Python objects in methods are the two
main concerns I have right now for long-term full adoption of the
limited API. (There are other difficulties, but for the ones I am
aware, I at least have an idea how to they need to be addressed).
I suppose it may actually be possible to hack around the FromSpec
issues, although I am not sure right now. unless subclassing
PyType_Type in C is for some reason different and very much
 And e.g. PySide seemed to "do" this, and got away with it, because
there is an additional NULL at the end, as a termination for slots or
so. Which for them is unused and they just happen to use.