[PySide] [Stackless] PySide problem, take #2: typeobject clash

Christian Tismer tismer at stackless.com
Mon Oct 21 22:33:37 CEST 2013


On 21.10.13 22:10, John Ehresman wrote:
> 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.

Yes I agree very much.
For me, the main concern was that there is something weird going on that 
prevends
PySide from working with stackless.

#1 was the way to convince myself that there is no principal problem 
with Stackless.

Of course it would be much nicer to solve it completely so that the 
extra compilation
goes away. Interestingly, PyQT has that solution since years, and the 
patch for stackless
is a single #ifdef around the type declaration.

The problem with PySide is that it directly pokes into types that it should
not touch at all.

Anyway, I'm happy that I can use both projects together. Maybe the effort
to get that into the official release is not worth it before solving #2.

cheers - chris

-- 
Christian Tismer             :^)   <mailto:tismer at stackless.com>
Software Consulting          :     Have a break! Take a ride on Python's
Karl-Liebknecht-Str. 121     :    *Starship* http://starship.python.net/
14482 Potsdam                :     PGP key -> http://pgp.uni-mainz.de
phone +49 173 24 18 776  fax +49 (30) 700143-0023
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
       whom do you want to sponsor today?   http://www.stackless.com/




More information about the PySide mailing list