When to use Py_INCREF(x) and Py_DECREF(x)

Will Ware wware at world.std.com
Wed Oct 25 13:35:37 EDT 2000


Opinderjit (bhellao at my-deja.com) wrote:
> I am confused with when to use Py_INCREF(x) and Py_DECREF(x). In the
> following example, I am creating a dictionary object, populating it,
> and returning it back to Python. Should I use Py_INCREF(dict) to
> increase the dictionary object's reference count?

Here is a debugging trick I have found helpful for these kinds of problems:
http://www.deja.com/getdoc.xp?AN=672487959&fmt=text
Hoping you will find this helpful (but no guarantee).

-- 
# - - - - - - - - - - - - - - - - - - - - - - - -
# Resistance is futile. Capacitance is efficacious.
# Will Ware	email:    wware @ world.std.com



More information about the Python-list mailing list