<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix"><tt>Correction:</tt><tt><br>
</tt><tt><br>
</tt><tt>this was too quick. Shiboken does not directly use the
threadstate</tt><tt><br>
</tt><tt>but only a reference, which is probably ok.</tt><tt> A
typical mis-reading<br>
that always hits me with C++.<br>
<br>
</tt><tt>Will investigate further, why Stackless Python causes
crashes with PySide.</tt><tt><br>
</tt><tt><br>
</tt><tt>Update:</tt><tt><br>
</tt><tt>It is pretty likely that there is a problem with extra
data fields behind</tt><tt><br>
</tt><tt>the type object structure, which is used by both pyside
and stackless.</tt><tt><br>
</tt><tt><br>
</tt><tt>from basewrapper.h :</tt><tt><br>
</tt><tt><br>
</tt>
<blockquote type="cite"><tt>/// PyTypeObject extended with C++
multiple inheritance information.</tt><tt><br>
</tt><tt>struct LIBSHIBOKEN_API SbkObjectType</tt><tt><br>
</tt><tt>{</tt><tt><br>
</tt><tt> PyHeapTypeObject super;</tt><tt><br>
</tt><tt> SbkObjectTypePrivate* d;</tt><tt><br>
</tt><tt>};</tt><tt><br>
</tt></blockquote>
<tt><br>
</tt><tt>This overlaps with the Stackless version of
PyHealTypeObject,</tt><tt><br>
</tt><tt>which is compatible but larger than CPython's!</tt><tt><br>
</tt><tt>At the end of the stackless heaptype lives a bytemap:</tt><tt><br>
</tt><tt><br>
</tt>
<meta charset="utf-8">
<tt><span style="color: rgb(0, 0, 0); font-size: 12px; font-style:
normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: normal; orphans: 2;
text-align: start; text-indent: 0px; text-transform: none;
white-space: pre; widows: 2; word-spacing: 0px;
background-color: rgb(255, 255, 255); display: inline !
important; float: none;"> </span></tt><tt><span class="n"
style="color: rgb(0, 0, 0); font-size: 12px; font-style:
normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: normal; orphans: 2;
text-align: start; text-indent: 0px; text-transform: none;
white-space: pre; widows: 2; word-spacing: 0px;">slp_methodflags</span></tt><tt><span
style="color: rgb(0, 0, 0); font-size: 12px; font-style:
normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: normal; orphans: 2;
text-align: start; text-indent: 0px; text-transform: none;
white-space: pre; widows: 2; word-spacing: 0px;
background-color: rgb(255, 255, 255); display: inline !
important; float: none;"> </span></tt><tt><span class="n"
style="color: rgb(0, 0, 0); font-size: 12px; font-style:
normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: normal; orphans: 2;
text-align: start; text-indent: 0px; text-transform: none;
white-space: pre; widows: 2; word-spacing: 0px;">slpflags</span></tt><tt><span
class="p" style="color: rgb(0, 0, 0); font-size: 12px;
font-style: normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: normal; orphans: 2;
text-align: start; text-indent: 0px; text-transform: none;
white-space: pre; widows: 2; word-spacing: 0px;">;</span></tt><tt><br>
</tt><tt><br>
</tt><tt>which misinterprets the field</tt><tt><br>
</tt><tt><br>
</tt><tt> SbkObjectTypePrivate* d;</tt><tt><br>
</tt><tt><br>
<br>
</tt><tt>cheers - chris</tt><tt><br>
</tt><tt><br>
<br>
</tt><tt>O</tt>n 12/8/12 4:45 AM, Christian Tismer wrote:<br>
</div>
<blockquote
cite="mid:54BFD7FD-0233-456A-99F3-EB617FD9D0AB@stackless.com"
type="cite">
<pre wrap="">Resent with a clearer subject line
This comes from the stackless mailing list.
PySide directly uses the threadstate structure of Cpython, which
is a protocol violation. See below...
Am 08.12.2012 um 01:49 schrieb Christian Tismer <a class="moz-txt-link-rfc2396E" href="mailto:tismer@stackless.com"><tismer@stackless.com></a>:
</pre>
<blockquote type="cite">
<pre wrap="">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:
<a class="moz-txt-link-freetext" href="http://qt.gitorious.org/pyside/shiboken/trees/master">http://qt.gitorious.org/pyside/shiboken/trees/master</a>
cheers - chris
[cross-posting to the pyside list]
--
Christian Tismer :^) <a class="moz-txt-link-rfc2396E" href="mailto:tismer@stackless.com"><mailto:tismer@stackless.com></a>
Software Consulting : Have a break! Take a ride on Python's
Karl-Liebknecht-Str. 121 : *Starship* <a class="moz-txt-link-freetext" href="http://starship.python.net/">http://starship.python.net/</a>
14482 Potsdam : PGP key -> <a class="moz-txt-link-freetext" href="http://pgp.uni-mainz.de">http://pgp.uni-mainz.de</a>
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? <a class="moz-txt-link-freetext" href="http://www.stackless.com/">http://www.stackless.com/</a>
_______________________________________________
PySide mailing list
<a class="moz-txt-link-abbreviated" href="mailto:PySide@qt-project.org">PySide@qt-project.org</a>
<a class="moz-txt-link-freetext" href="http://lists.qt-project.org/mailman/listinfo/pyside">http://lists.qt-project.org/mailman/listinfo/pyside</a>
</pre>
</blockquote>
<pre wrap="">_______________________________________________
PySide mailing list
<a class="moz-txt-link-abbreviated" href="mailto:PySide@qt-project.org">PySide@qt-project.org</a>
<a class="moz-txt-link-freetext" href="http://lists.qt-project.org/mailman/listinfo/pyside">http://lists.qt-project.org/mailman/listinfo/pyside</a>
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Christian Tismer :^) <a class="moz-txt-link-rfc2396E" href="mailto:tismer@stackless.com"><mailto:tismer@stackless.com></a>
Software Consulting : Have a break! Take a ride on Python's
Karl-Liebknecht-Str. 121 : *Starship* <a class="moz-txt-link-freetext" href="http://starship.python.net/">http://starship.python.net/</a>
14482 Potsdam : PGP key -> <a class="moz-txt-link-freetext" href="http://pgp.uni-mainz.de">http://pgp.uni-mainz.de</a>
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? <a class="moz-txt-link-freetext" href="http://www.stackless.com/">http://www.stackless.com/</a></pre>
</body>
</html>