Reference Counts & Extensions..
John
john.thai at dspfactory.com
Tue Jun 12 16:49:05 EDT 2001
Hi,
I'm writing an extension module and in my functions I return something
like:
return Py_BuildValue("i", 1);
Will this cause a memory leak? Should I be doing this:
PyObject *pyObj = PyBuildValue("i", 1);
Py_INCREF(pyObj);
return pyObj;
Also, what if I make pyObj a global variable, can I then use the first
method since the reference will be borrowed, like so:
return pyObj;
Thanks,
John
More information about the Python-list
mailing list