Embedding Python in C++ application: Question #1

Tim Peters tim.one at home.com
Tue Dec 4 23:09:49 EST 2001


[Russell Turpin]
> OK. I'm finding the relevant interfaces in Python/C API.
> Do I read this right, that all new objects are created
> with a refcount of 1 ,

Yes.

> so that a called function can pass them to the caller without ref-count
> manipulation?

Yes.  The flip side of that is that if you don't pass ownership of the
reference on to someone else, you must explicitly Py_DECREF it (else it will
leak).





More information about the Python-list mailing list