[Bf-python] Little error with 228c

Willian Padovani Germano wgermano at ig.com.br
Tue Sep 30 06:24:12 CEST 2003


From: "Stephen Swaney" <sswaney at swbell.net>
(...)
> 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?

Yes.  Check setAttr in Camera.c, for example, it handles all the cases by
first creating the tuple.

> Plus we need to check that the Py_BuildValue call succeeded.

To be on the safest side, yes.  But probably the only error that could
happen (assuming we write it properly) is a memory error (no mem to create
pyobject).

> 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.

Yes, I think so, too.  Your idea of splitting in both cases (first test for
vars returned from setAttr directly, then create the tuple and check for the
vars that will be handled by the set*() methods) is a good solution, if
necessary for Object.

--
Willian, wgermano at ig.com.br




More information about the Bf-python mailing list