Mark Dickinson <[email protected]> added the comment:
I agree with Raymond about the Py_INCREF. I could see more uses for this macro
without the Py_INCREF, especially for things like in-place arithmetic
operations. The following pattern appears a lot in code like
Objects/longobject.c:
Old code:
/* add one to x */
temp = PyNumber_Add(x, one);
Py_DECREF(x);
x = temp;
if (x == NULL)
return NULL;
With a non-INCREF version of Py_SETREF:
/* add one to x */
Py_SETREF(x, PyNumber_Add(x, one));
if (x == NULL)
return NULL;
----------
nosy: +mark.dickinson
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue3081>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com