[PyQt] Re: ConvertToSubClass problem

Giovanni Bajo rasky at develer.com
Tue Nov 18 13:07:12 GMT 2008


On Tue, 2008-11-18 at 12:17 +0100, Matteo Bertini wrote:
> On 18-11-2008 1:12, Giovanni Bajo wrote:
> > Hi Phil,
> >
> > this patch:
> >
> > 2007/02/25  0:19:29  phil
> > Included Matt Newell's fix for making sure that a sub-class convertor
> > returns the most specific type available.
> >
> > causes problem with PyQt3Support. Specifically, the
> > ConvertToSubClassCode in q3mainwindow.sip does not seem to work as
> > expected. The bug manifests itself when the code is invoked to find the
> > most derived class for a Q3ListView. The convertor correctly detects the
> > correct type, but this additional check (added by Matt Newell):
> >
> > &&  !PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)subtype)
> >
> > make it so that the convertor's result is ignored.
> >
> > It might well be that the bug is in the placement of the convertor
> > within pyqt3support. It is currently placed within Q3MainWindow, but it
> > contains conversion code for many different classes (unrelated to
> > Q3MainWindow). I'm afraid I'm not sure where one should place the
> > convertors code.
> >
> > Any guess on what exactly is the bug?
> 
> I have noticed a fun thing, rewriting the test as:
> 
> && PyType_IsSubtype((PyTypeObject *)subtype, (PyTypeObject *)type)
> 
> everything seems to work as espected again...

By inverting the arguments, you're effectively inverting the resulting
truth-value and thus obtaining the same effect that you obtain by
commenting it.
-- 
Giovanni Bajo
Develer S.r.l.
http://www.develer.com




More information about the PyQt mailing list