[Bf-python] Little error with 228c
Stephen Swaney
sswaney at swbell.net
Tue Sep 30 06:08:49 CEST 2003
Willian Padovani Germano wrote:
>
> Don't worry, Stephen, you know one or another bug always slips in,
> happened/happens to us all. Michel will probably take a look there, if only
> 'name' is causing trouble (or if not many are), then simple "Py_Build" calls
> in place can solve the issue, like: return Object_setName(self,
> Py_Build("(O)", value)) (from memory, not checking the exact names now).
There were half a dozen places that had the same problem.
Since we are calling another func rather than returning a
value, we need to decrement the reference created by
Py_BuildValue after we are done with it, yes?
Plus we need to check that the Py_BuildValue call succeeded.
Plus the setXXX calls return a PyObject* rather than an int like
Object_setAttr.
Rather than do the BuildValue, check for success, call setXXX(),
check return status, DECREF dance over and over, it seemed better
to bite the bullet and restructure the code a little.
Of course, there is always more than one way to solve a problem!
That is what makes the game so much fun.
I figure I've thrown the dead goat over the fence.
It is up to Michel to decide how to dispose of the carcass.
Regards,
Stephen
--
Stephen Swaney
sswaney at swbell.net
More information about the Bf-python
mailing list