I can give some comments on this, as I have studied<br>in detail how PyQt behaves.<br><br>The main problem is, on one side you have Python with :<br>- reference counting<br>- garbage collector<br>On the other side, there is Qt with :<br>
- parent/child memory management<br>- cross thread signals/slot relations<br><br>And you need to 'merge' these 4 concepts in the bindings.<br>This is notoriously difficult, and has a lot of edge cases.<br>I believe PyQt handles all of them correctly, but only after<br>
years of tweaking the code.<br><br>This is also why it's not straightforward to use existing <br>binding tools such as SWIG or Cython to 'wrap' Qt objects<br>and make them available in Python.<br><br>To make PySide succeed, this behaviour is the most <br>
important part to be documented !  It should be possible<br>for anyone to review what happens in what case and why.<br><br>Over the years, I have assembled some unit tests that<br>check some of the edge cases :<br><br><a href="https://www.gitorious.org/camelot/camelot/blobs/master/test/test_qt_bindings.py">https://www.gitorious.org/camelot/camelot/blobs/master/test/test_qt_bindings.py</a><br>
<br>Cheers,<br><br>Erik<br><br><div class="gmail_quote">On Mon, Dec 10, 2012 at 7:20 PM, Henry Gomersall <span dir="ltr"><<a href="mailto:heng@cantab.net" target="_blank">heng@cantab.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Mon, 2012-12-10 at 12:53 -0500, John Ehresman wrote:<br>
> Qt defines some common classes (e.g. QObject) and some rules that<br>
> govern<br>
> when objects are deleted.  I'm sure that a large part of the work that<br>
> went into PySide was to manage the lifetime and behavior of Python<br>
> wrapper objects based on how Qt works.  This sort of code is Qt<br>
> specific<br>
> and not generic.<br>
<br>
</div>Can you give me an example of the problem here? I mean, is the issue<br>
that the binding code needs to keep track of when (say) a QObject is<br>
deleted (in which case does QObjectCleanupHandler not provide that<br>
support) or is it that the bindings _should_ be deleting objects based<br>
on some documented rules?<br>
<br>
Cheers,<br>
<br>
Henry<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
PySide mailing list<br>
<a href="mailto:PySide@qt-project.org">PySide@qt-project.org</a><br>
<a href="http://lists.qt-project.org/mailman/listinfo/pyside" target="_blank">http://lists.qt-project.org/mailman/listinfo/pyside</a><br>
</div></div></blockquote></div><br>