[Stackless] PySide problem, take #2: typeobject clash
jpe at wingware.com
Mon Oct 21 22:10:08 CEST 2013
On 10/21/13 1:07 PM, Christian Tismer wrote:
> No, it is about the type layout, there are (ah, here came the word frame
> again?! ) there are type fields in CPython that stackless does not have.
> Well, and because these structures are different in size, pyside must
> be compiled using stackless, otherwise it crashes ugly.
I think I see the problem; to me, at least, it's useful to see the
stackless version of object.h at
http://www.stackless.com/browser/Include/object.h It looks like
stackless moves the fields defined in PyHeapTypeObject into
PyTypeObject, adds at least one additional field, and then #define's
PyHeapTypeObject to PyTypeObject. This leads to two problems, which are
somewhat separable --
1) When compiling, there is no ht_type field in PyHeapTypeObject. This
is what Christian's patch addresses.
2) At runtime, both pyside and stackless assume they can store
additional type data in the same place after the PyTypeObject data.
pyside stores a pointer to a separate structure here.
I think it might be worth trying to fix #2 as well as #1 so there's no
need for separate pyside builds for stackless. It may be possible to
allocate these type objects on the heap so the length of the base object
can be determined at runtime. I haven't thought this all the way
through, but think it might work, though it might or might not require
an ABI break.
As for the current patch, I think it needs motivating comments to at
least point developers who aren't familiar with the stackless changes to
PyTypeObject in the right direction.
More information about the Stackless