[PyQt] Perhaps a bug with virtual methods?

Phil Thompson phil at riverbankcomputing.com
Thu May 15 22:05:05 BST 2008


On Wednesday 14 May 2008 17:23:47 Andrew Perella wrote:
> Suppose I have the following sip definitions:
>
>
>
> class A
>
> {
>
> public:
>
>  virtual void Enter();
>
> };
>
> class B:A
>
> {
>
> public:
>
>
>
> };
>
> class C: B
>
> {
>
> public:
>
>
>
> };
>
>
>
>
>
> The generated code produces an "Enter()" method of the sip wrapped C class
> where if the method is not passed onto python it calls the baseclass
> A:Enter() rather than B:Enter()
>
>
>
> void sipC::Enter()
>
> {
>
>     typedef void (*sipVH_Game_2)(sip_gilstate_t,PyObject *);
>
>
>
>     sip_gilstate_t sipGILState;
>
>     PyObject *meth;
>
>
>
>     meth =
> sipIsPyMethod(&sipGILState,&sipPyMethods[0],sipPySelf,NULL,sipNm_States_Ent
>e r);
>
>
>
>     if (!meth)
>
>     {
>
>         A::Enter();
>
>         return;
>
>     }
>
>
>
>
> ((sipVH_Game_2)(sipModuleAPI_States_Game->em_virthandlers[2]))(sipGILState,
>m eth);
>
> }
>
>
>
> This seems like a big problem. Have I missed something?

Why is it a problem - given there is no such method B::Enter()?

Phil


More information about the PyQt mailing list