[PyQt] Perhaps a bug with virtual methods?

Andrew Perella ajp at eutechnyx.com
Mon May 19 09:54:04 BST 2008


Thanks Phil,
In my case there is a B::Enter on the c++ side - I just didn't want to
expose it. The class is sipped just so that we can pass pointers to class C
to functions that expect class B. 
I realise now that you expect all virtual methods to be mentioned in every
class in the sip file. Would it not make sense just to call B::Enter anyway
even if sip doesn't know about it?
Cheers,
Andrew


-----Original Message-----
From: pyqt-bounces at riverbankcomputing.com
[mailto:pyqt-bounces at riverbankcomputing.com] On Behalf Of Phil Thompson
Sent: 15 May 2008 22:05
To: pyqt at riverbankcomputing.com
Subject: Re: [PyQt] Perhaps a bug with virtual methods?

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
_______________________________________________
PyQt mailing list    PyQt at riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

This email has been scanned for all known viruses by the Email Protection
Agency.


This e-mail is confidential and may be privileged. It may be read, copied and used only by the intended recipient. No communication sent by e-mail to or from Eutechnyx is intended to give rise to contractual or other legal liability, apart from liability which cannot be excluded under English law. 

This email has been scanned for all known viruses by the Email Protection Agency.


www.eutechnyx.com Eutechnyx Limited. Registered in England No: 2172322



More information about the PyQt mailing list