[PyQt] SIP Bug: virtual function wrapped twice due to deep inheritance from base class and ABC
Phil Thompson
phil at riverbankcomputing.com
Sat Jul 3 09:47:56 BST 2010
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
More information about the PyQt
mailing list