How to DECREF an Python object to return?
Fredrik Lundh
fredrik at effbot.org
Fri Jan 5 11:25:03 EST 2001
</F> wrote:
> result = PyBuildValue("OO", tuple, othertuple);
>
> Py_DECREF(tuple);
> Py_DECREF(othertuple);
>
> return result;
looks like someone used the time machine again:
just discovered that "N" does the same thing as
"O", except for incrementing the reference count.
in other words, the above code fragment is better
written as:
return PyBuildValue("NN", tuple, othertuple);
Cheers /F
More information about the Python-list
mailing list