[Bf-python] internal Python object conversion question

Gilbert, Joseph jgilbert at tigr.org
Wed Jun 15 22:12:20 CEST 2005


Yea prob better to write something like:
item = PySequence_GetItem( pyOb, 0 );
if(item == NULL)
	return -1; 
float f = (float) PyFloat_AS_DOUBLE(item);
Py_DECREF(item);
Hope I didn't write that.:/ 

-----Original Message-----
From: bf-python-bounces at projects.blender.org
[mailto:bf-python-bounces at projects.blender.org] On Behalf Of Ken Hughes
Sent: Wednesday, June 15, 2005 3:52 PM
To: Blender Foundation Python list
Subject: [Bf-python] internal Python object conversion question

Just saw something in a BPython module similar to this:

float f = (float) PyFloat_AsDouble ( PySequence_GetItem( pyOb, 0 ) );

My understanding of PySequence_GetItem() is that it returns a new
reference.  Doesn't this code leave that PyObject floating around
until termination?

Ken
_______________________________________________
Bf-python mailing list
Bf-python at projects.blender.org
http://projects.blender.org/mailman/listinfo/bf-python



More information about the Bf-python mailing list