[Python-Dev] Borrowed and Stolen References in API

Greg Ewing greg.ewing at canterbury.ac.nz
Thu May 5 00:23:01 CEST 2011

Amaury Forgeot d'Arc wrote:

> It's in the file Doc/data/refcounts.dat
> in some custom format.

However, it doesn't seem to quite convey the same information.
It lists the "refcount effect" on each parameter, but translating
that into the notion of borrowed or stolen references seems
to require knowledge of what the function does.

For example, PyDict_SetItem has:


All of these parameters take borrowed references, but the
key and val get incremented because they're being stored
in the dict.

So this file appears to be of limited usefulness.


More information about the Python-Dev mailing list