Message325516
| Author |
petr.viktorin |
| Recipients |
Christian.Tismer, Dormouse759, docs@python, loewis, nascheme, ncoghlan, petr.viktorin, serhiy.storchaka |
| Date |
2018年09月17日.09:25:10 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1537176311.02.0.956365154283.issue26979@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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! |
|