[PyQt] SIP Bug: virtual function wrapped twice due to deep inheritance from base class and ABC

Demetrius Cassidy dcassidy36 at mass.rr.com
Sat Jul 3 16:46:12 BST 2010


There was a rogue enum in my sip file! I removed Reusability from
PIPSocket.sip and it works as intended now.

Thanks Phil.


Phil Thompson-5 wrote:
> 
> On Fri, 2 Jul 2010 06:49:59 -0700 (PDT), Demetrius Cassidy
> <dcassidy36 at mass.rr.com> wrote:
>> Sorry Phil - corrected inheritance tree:
>> 
>> PUDPSocket <- PIPDataGramSocket <- PIPSocket <- PSocket (ABC) 
>> PTCPSocket <- PIPSocket <- PSocket (ABC)
>> 
>> PUDPSocket does not have a 'Listen' function in it, instead it just
>> inherits
>> it from PIPSocket, who overrides PSocket. 
> 
> No it doesn't. PIPSocket::Listen() has a different signature to
> PSocket::Listen() because they refer to different enums (both called
> Reusability).
> 
>> PTCPSocket DOES include a 'Listen' function in it, and overrides it from
>> PIPSocket and PSocket.
>> 
>> I've attached the corresponding sip files and the generated .cpp files
> from
>> sip. 
>> 
>> Below I've also included a snippet of the generated code for both
> classes.
>> The weird thing is that SIP wraps the PIPSocket Listen function, along
> with
>> the one from PSocket. http://old.nabble.com/file/p29056623/ptlib.rar
>> ptlib.rar 
>> 
>> 
>> class sipPUDPSocket : public PUDPSocket
>> {
>> public:
>>     ....
>> 
>>     /*
>>      * There is a protected method for every virtual method visible from
>>      * this class.
>>      */
>> protected:
>>     ...
>>     PBoolean Listen(unsigned,WORD,PIPSocket::Reusability);
>>     PBoolean Listen(const
>> PIPSocket::Address&,unsigned,WORD,PIPSocket::Reusability);
>>     ...
>>     PBoolean Listen(unsigned,WORD,PSocket::Reusability);
>> }
>> 
>> class sipPTCPSocket : public PTCPSocket
>> {
>> public:
>>     ...
>>     /*
>>      * There is a protected method for every virtual method visible from
>>      * this class.
>>      */
>> protected:
>>     PBoolean Listen(unsigned,WORD,PIPSocket::Reusability);
>>     PBoolean Listen(const
>> PIPSocket::Address&,unsigned,WORD,PIPSocket::Reusability);
>>     ...
>>     PBoolean Listen(unsigned,WORD,PSocket::Reusability);
>> };
>> 
>> Both classes share the same exact inheritance bug when wrapped:
> 
> Given your .sip files, the above generated code is correct.
> 
> It looks like you have a bug in your C++ code - I'd remove the
> PIPSocket::Reusability enum.
> 
> Phil
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> 
> 

-- 
View this message in context: http://old.nabble.com/SIP-Bug%3A-virtual-function-wrapped-twice-due-to-deep-inheritance-from-base-class-and-ABC-tp28936011p29064613.html
Sent from the PyQt mailing list archive at Nabble.com.



More information about the PyQt mailing list