Message325516
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! |
|
Date |
User |
Action |
Args |
2018-09-17 09:25:11 | petr.viktorin | set | recipients:
+ petr.viktorin, loewis, nascheme, ncoghlan, docs@python, serhiy.storchaka, Christian.Tismer, Dormouse759 |
2018-09-17 09:25:11 | petr.viktorin | set | messageid: <1537176311.02.0.956365154283.issue26979@psf.upfronthosting.co.za> |
2018-09-17 09:25:11 | petr.viktorin | link | issue26979 messages |
2018-09-17 09:25:10 | petr.viktorin | create | |
|