[PyQt] sip: wrong class virtual function being called
Phil Thompson
phil at riverbankcomputing.com
Tue Jun 9 10:33:17 BST 2015
On 05/06/2015 6:34 pm, Jeremy Sanders wrote:
> Hi -
>
> I'm having a problem with sip where the wrong version of a virtual
> function is being called. I'm overriding a virtual function in a
> python subclass of a C++ class. This function is being called by a C++
> container, which owns the class instance. If I keep a Python reference
> to the instance, then everything works.
>
> Please see the attached code. test.py calls the C++ code. Normally the
> code prints
>
> Object::func()
> 42
>
> If del in test.py is uncommented, then it prints
>
> Object::func()
> Object::func()
>
> Therefore the inherited virtual function is being called, not the
> overriding function.
>
> Is this a problem with my code, or a SIP bug? I'm using SIP 4.16.3 (on
> Ubuntu x86-64). Is there a workaround? I can change the C++ code.
SIP bug - should be fixed in tonight's snapshot/current hg.
I'd appreciate some quick testing as I want to make new releases very
soon.
Thanks,
Phil
More information about the PyQt
mailing list