[EMAIL PROTECTED] wrote:
> int
> set_all(PyObject *target, PyObject *item)
> {
> int i, n;
>
> n = PyObject_Length(target);
> if (n < 0)
> return -1;
> for (i = 0; i < n; i++) {
> if (PyObject_SetItem(target, i, item) < 0)
> return -1;
> }
> return 0;
> }
>
> *WHY* don't you need a Py_INCREF(item); in the for loop!?!?!?Thats because PyObject_SetItem automatically increases the refcount of the 'item' that you pass. Whereas, PyTuple_SetItem and PyList_SetItem *DONT* automatically increment the refcount. Sreeram
signature.asc
Description: OpenPGP digital signature
-- http://mail.python.org/mailman/listinfo/python-list
