[Python-Dev] PyTuple_Pack added references undocumented
Guido van Rossum
gvanrossum at gmail.com
Mon Aug 8 04:14:43 CEST 2005
On 8/7/05, Edward C. Jones <edcjones at comcast.net> wrote:
> According to the source code, PyTuple_Pack returns a new reference (it
> calls PyTuple_New). It also Py_INCREF's all the objects in the new
> tuple. Is this unusual behavior? None of these added references are
> documented in the API Reference Manual.
This seems the only sensible behavior given what it does.
I think the INCREFs don't need to be documented because you don't have
to worry about them -- they follow the normal pattern of reference
counts: if you owned an object before passing it to PyTuple_Pack(),
you still own it afterwards.
The docs say that it returns a new object, so that's in order too.
It's not listed in refcounts.dat; that seems an omission (or perhaps
the function's varargs signature doesn't fit in the pattern?).
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev
mailing list