How to DECREF an Python object to return?
Fredrik Lundh
fredrik at effbot.org
Fri Jan 5 11:25:03 EST 2001
More information about the Python-list mailing list
Fri Jan 5 11:25:03 EST 2001
- Previous message (by thread): How to DECREF an Python object to return?
- Next message (by thread): How to DECREF an Python object to return?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
</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
- Previous message (by thread): How to DECREF an Python object to return?
- Next message (by thread): How to DECREF an Python object to return?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list