When to free memory for C wrapper?

2005-10-13 Thread Java and Swing
I have been posting lately about writing a C wrapper so Python can access my C functions. In my wrapper function I have something like... static PyObject *wrap_doStuff(PyObject *self, PyObject *args) { PyObject *data; char *result; long *d; PyArg_ParseTuple(args, O:wrap_doStuff,

Re: When to free memory for C wrapper?

2005-10-13 Thread Java and Swing
One other thing, I was reading about Py_DECREF...and I see it says A safe approach is to always use the generic operations (functions whose name begins with PyObject_, PyNumber_, PySequence_ or PyMapping_). These operations always increment the reference count of the object they return. This