[pygtk] using Py_BuildValue or return statement

Hrvoje Nikšić hrvoje.niksic at avl.com
Tue Jun 26 15:59:57 WST 2007


On Mon, 2007-06-25 at 00:03 -0700, varun_shrivastava wrote:
> Is there a difference between returning a python object using
> return py_obj;
> or
> Py_BuildValue("O",py_obj);

Py_BuildValue will increment the object's reference count.  In this case
it doesn't make sense to use Py_BuildValue, you can just write:

Py_INCREF(py_obj);
return py_obj;





More information about the pygtk mailing list