Hello, I am writing a Python C extension and I have some trouble understanding how reference counting works exactly. Though I think I understand the practice on simple operations (see my question at stackoverflow: http://stackoverflow.com/questions/4657764/py-incref-decref-when), but on more "complex" operations I cannot quite grasp it yet.
For example, in the following helper function, do I need to DECREF or are all the references automatically destroyed when the function returns? double Py_GetAttr_DoubleFromFloat(PyObject *obj, const char *attr) { if ((PyObject_GetAttrString(obj, attr) == False) || (PyObject_HasAttrString(obj, attr) == False)) { return -9999.0; } return PyFloat_AsDouble(PyNumber_Float(PyObject_GetAttrString(obj, attr))); } Please share your thoughts, thanks in advance, kind regards, Izz ad-Din
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor