[Python-Dev] Borrowed and Stolen References in API (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Thu May 5 00:04:51 CEST 2011
- Previous message: [Python-Dev] Borrowed and Stolen References in API
- Next message: [Python-Dev] The zombi thread of the Tcl library
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Mark Shannon wrote:
The online documentation specifies which API function borrow and/or steal references (as opposed to the default behaviour). Yet, I cannot find this information anywhere in the source.
There are comments in some places, e.g. in listobject.h:
*** WARNING *** PyList_SetItem does not increment the new item's reference count, but does decrement the reference count of the item it replaces, if not nil. It does decrement the reference count if it is not inserted in the list. Similarly, PyList_GetItem does not increment the returned item's reference count.
If you're looking for evidence in the actual code, there's nothing particular to look for -- it's implicit in the way the function works overall.
-- Greg
- Previous message: [Python-Dev] Borrowed and Stolen References in API
- Next message: [Python-Dev] The zombi thread of the Tcl library
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]