Python C Extensions
pavlovevidence at gmail.com
Thu Feb 24 18:20:45 CET 2011
On Feb 24, 8:46 am, "aken8... at yahoo.com" <aken8... at yahoo.com> wrote:
> Thank you very much, it worked.
> I thought the PyDict_SetItem should assume ownership
> of the passed object and decrease it's reference count (I do not know
> Does this also go for the Lists ? Should anything inserted into list
> be DECRED-ed ?
The Python C API documentation has this information--if a function is
documented as borrowing a reference, then it behaves as you were
expecting (it doesn't increase the reference count). If it's
documented as creating a new reference, it does increase the reference
I don't know if there's a simple rule to know of a function borrows or
creates a new reference; I've never noticed one.
More information about the Python-list