[PySide] PySide progress! At least a good reason to crash

Christian Tismer tismer at stackless.com
Sat Dec 8 01:49:23 CET 2012


Hi friends,

this evening, I looked a bit into shiboken, the module that is used
for creating python interfaces for PySide, and now I'm
pretty confident that I found a reason that is creating some issues.

libshiboken has an include file called sbkpython.h, and this includes
python.h from the installed python.

And now we come to the interesting stuff:

There is threadstatesaver.h and threadstatesaver.cpp !
The latter has code like:

void ThreadStateSaver::save()
{
     if (PyEval_ThreadsInitialized())
         m_threadState = PyEval_SaveThread();
}

But that code uses the threadstate definition from the cpython threadstate
module, instead of the different (at least larger) structure in stackless
threadstate. ;-)

IOW., things *might* work if pyside is built against stackless python
instead of CPython.

Today I looked at a simple PySide script and a larger one - they both used
multiple threads for startup. No idea if this code is involved there,
python did not use threads, but I could imagine that is at least a time 
bomb.


Now, the question is: how to resolve this?
------------------------------------------

One way that needs testing is if PySide works ok on stackless
when built from source. I could write an installer for this case.

The other question is: can we change stackless in a way that works
with PySide compiled for CPython?

That would mean: tstate must stay completely unchanged in size.
I guess the extra info that we use would neet to be put into a
different structure, and the linkage back to tstate is a little trick,
at least.

Another way would be to add a patch to libshiboken, that checks the
real size of tstate dynamically. This would be an easier patch, although
I think that at the moment it is not so easy to get anything into pyside,
quickly.

I would like to get your opinion.
And I definately want to make stackless work with pyside.

The source code can be inspected here:

http://qt.gitorious.org/pyside/shiboken/trees/master

cheers - chris

[cross-posting to the pyside list]

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