[PyQt] sip: Problem with inheritance and function overloads

Daniel Stöckel dstoeckel at bioinf.uni-sb.de
Fri Jul 23 09:53:37 BST 2010


Hi,

I seem to have noticed a bug in sip concerning function overloads that occur 
because of inheritance:

I have a C++ project in which I have classes like this (I used this actual toy 
example to reproduce the problem):

  class A
  {
      public:
          void do_sth(DummyA&);
  };

  class B : public A
  {
      public:
          void do_sth(DummyB&);
  };

The sip wrapper code is also straight forward:

  class A
  {
  %TypeHeaderCode
      #include "bla.h"
  %End
      public:
          void do_sth(DummyA&);
  };

  class B : A 
  {
  %TypeHeaderCode
      #include "bla.h"
  %End
      public:
          void do_sth(DummyB&);
  };

In C++ it is now possible to call do_sth on class B with both: DummyA and 
DummyB due to function overloading. In the generated sip wrapper however 
calling do_sth on an object of type B with an object of type DummyA causes the 
following error:
	"TypeError: B.do_sth(): argument 1 has unexpected type 'DummyA'"
Note that regular overloading, so if both do_sth() methods were defined and 
wrapped in class B, works just fine. It seems to me as if sip does not 
propagate information about function overloads down the inheritance tree.

Am I doing something wrong or is this indeed a bug/limitation in sip?

Greetings,
Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100723/2256f87d/attachment.pgp>


More information about the PyQt mailing list