This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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!
History
Date User Action Args
2018-09-17 09:25:11petr.viktorinsetrecipients: + petr.viktorin, loewis, nascheme, ncoghlan, docs@python, serhiy.storchaka, Christian.Tismer, Dormouse759
2018-09-17 09:25:11petr.viktorinsetmessageid: <1537176311.02.0.956365154283.issue26979@psf.upfronthosting.co.za>
2018-09-17 09:25:11petr.viktorinlinkissue26979 messages
2018-09-17 09:25:10petr.viktorincreate