[Bf-python] tp_getset conversion update

Ken Hughes khughes at pacific.edu
Sun Sep 18 00:27:18 CEST 2005


Stephen Swaney wrote:
> On Fri, Sep 16, 2005 at 07:45:28AM -0700, Ken Hughes wrote:
>
> To use Lamp as an example, we probably need to do something like
> the following rather than casting arg 3 to void*:
> 
> typedef int (*PYFUNC)( PyObject *self, PyObject *args);
> 
> static PyObject *Lamp_oldsetName( BPy_Lamp * self, PyObject * args )
> {
> 	return EXPP_setterWrapper ( (void *)self, args, (PYFUNC)Lamp_setName );
> }
> 
> Obviously, if the solution is a typedef, it needs to go someplace other
> than in each source module.

OK, so I'm guess the compiler would also check that Lamp_setName() was 
declared as:

int Lamp_setName( PyObject *self, PyObject *args)

as well, an inside Lamp_setName() we have to cast *self back into 
whatever it really points at (which is what about half the methods do 
anyway).

Can someone verify the above corrects the warnings?  If so, I'll post an 
updated patch to the tracker.

Ken




More information about the Bf-python mailing list