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 Christian.Tismer
Recipients Christian.Tismer, Dormouse759, docs@python, loewis, nascheme, ncoghlan, petr.viktorin, serhiy.storchaka
Date 2018-09-17.11:35:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1537184139.14.0.956365154283.issue26979@psf.upfronthosting.co.za>
In-reply-to
Content
> ... 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?

Yes, you are exactly right. I needed access to very few fields.
In particular:

    PyTypeObject.tp_init
    PyTypeObject.tp_basicsize    (workaround using Python)

    <a_few_types>.tp_dict

The latter would not be necessary for Pep 384, but for my __signature__
extension, but that is another story :)

<basicsize>

> 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.

Oh? I thought it is automatically allowed to use if it is exposed
by Python. I thought that the central property of basicsize would be
that it is no longer a constant, but that a size is always there.

Sure, we could have worked without the size and create a more complex 
structure that does not know anything about types. I actually started
with that approach. But in the end I thought it would not hurt to assume 
that there is a (variable) size, as long as we are below Python 4.0 .

> I'm sure your tests will tell you when the time comes, and I hope we'll
> have a better solution then!

Yes, I had a very hard time to convince myself that I _may_ use some
assumptions, as long as I always prove that these assumptions are right.
But in a way, I feel guilty and would prefer to go without any trickery.

> BTW, I'm honestly very impressed how far PySide got with the limited API!

Thank you! I was hoping to get ready after 2 months, when I realized that 
all types needed to be changed. So I pulled teeth, and it took >5 months.
Btw., I don't understand how the PyQt5 guy(s) solved this. Maybe his 
structure is way cleaner and simpler than the PySide mess? I'll ask him.

Ciao -- Chris
History
Date User Action Args
2018-09-17 11:35:39Christian.Tismersetrecipients: + Christian.Tismer, loewis, nascheme, ncoghlan, petr.viktorin, docs@python, serhiy.storchaka, Dormouse759
2018-09-17 11:35:39Christian.Tismersetmessageid: <1537184139.14.0.956365154283.issue26979@psf.upfronthosting.co.za>
2018-09-17 11:35:39Christian.Tismerlinkissue26979 messages
2018-09-17 11:35:39Christian.Tismercreate