Message102645
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; |
|
Date |
User |
Action |
Args |
2010-04-08 21:03:07 | mark.dickinson | set | recipients:
+ mark.dickinson, rhettinger, jcea, exarkun, belopolsky, pitrou, _doublep, benjamin.peterson |
2010-04-08 21:03:06 | mark.dickinson | set | messageid: <1270760586.94.0.654979580484.issue3081@psf.upfronthosting.co.za> |
2010-04-08 21:03:04 | mark.dickinson | link | issue3081 messages |
2010-04-08 21:03:03 | mark.dickinson | create | |
|