Petr Viktorin <encu...@gmail.com> added the comment:

Ah! It seems you don't need access to all tp_* slots of any type here, but just 
to PyType.tp_new – only one specific type, and only one specific slot.
Specifically, you need a way to create class with a metaclass, from C.

Is that right? Or was this only an example of a larger problem?

(Sorry for drawing the discussion out! Dropping the checks in PyType_GetSlot 
would be a simple change technically, but it doesn't match my mental model of 
what the stable ABI should be. I'm hoping to get a better solution for your use 
case, and others like it.)


> To obtain sizeof(PyType_Type), we simply used the Python code
>     type.__basicsize__
> It is a simple trick, but probably very few people know this path
> to get that info. At least, for me it took way too long ;-)

Well, basicsize might be exposed through Python, but it's still not part of the 
limited API. Which is fine – all that means is you might need to change the 
extension for some future version of Python. I'm sure your tests will tell you 
when the time comes, and I hope we'll have a better solution then!
BTW, I'm honestly very impressed how far PySide got with the limited API!

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue26979>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to