[Bf-python] bug in Camera.c

Jacques Guignot guignot at wanadoo.fr
Sat Jun 7 12:38:10 CEST 2003


Willian Padovani Germano wrote:

>
>Which looks fine.  Remove it?  Could you be more specific?
>

Oops! 
The "dangerous" line is  at the end of static int CameraSetAttr 
(C_Camera *self, char *name, PyObject *value)
when you do a  Py_DECREF(valtuple)  (the last  Py_DECREF, not the one in 
the if )

I'm not very good in ref counting, and Python is somehow strange with 
that (never understood why PyNone should be incref or decrefd for instance!)

If you try this little script :

import Blender
cam = Blender.Camera.Get("Camera")   ###I suppose a camera named 
"Camera" exists
cam.lens = 12

and launch it 5 or 6 times (Alt-P, Alt-P,...)  blender finally 
segfaults. If we remove the last Decref line, it does not. :-)
Don't ask me why, I dunno...

Cheers.
J.









More information about the Bf-python mailing list