Index: Modules/itertoolsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/itertoolsmodule.c,v retrieving revision 1.34 diff -u -r1.34 itertoolsmodule.c --- Modules/itertoolsmodule.c 15 Jul 2004 05:32:47 -0000 1.34 +++ Modules/itertoolsmodule.c 1 Sep 2004 04:20:02 -0000 @@ -250,8 +250,7 @@ r = gbo->currvalue; gbo->currvalue = NULL; - Py_DECREF(gbo->currkey); - gbo->currkey = NULL; + Py_CLEAR(gbo->currkey); return r; } Index: Objects/enumobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/enumobject.c,v retrieving revision 1.17 diff -u -r1.17 enumobject.c --- Objects/enumobject.c 25 Aug 2004 19:42:12 -0000 1.17 +++ Objects/enumobject.c 1 Sep 2004 04:20:02 -0000 @@ -230,10 +230,7 @@ PyErr_Clear(); } ro->index = -1; - if (ro->seq != NULL) { - Py_DECREF(ro->seq); - ro->seq = NULL; - } + Py_CLEAR(ro->seq); return NULL; } Index: Objects/genobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/genobject.c,v retrieving revision 1.3 diff -u -r1.3 genobject.c --- Objects/genobject.c 27 Jun 2004 15:43:12 -0000 1.3 +++ Objects/genobject.c 1 Sep 2004 04:20:03 -0000 @@ -51,8 +51,7 @@ * may keep a chain of frames alive or it could create a reference * cycle. */ assert(f->f_back != NULL); - Py_DECREF(f->f_back); - f->f_back = NULL; + Py_CLEAR(f->f_back); /* If the generator just returned (as opposed to yielding), signal * that the generator is exhausted. */ Index: Objects/iterobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/iterobject.c,v retrieving revision 1.18 diff -u -r1.18 iterobject.c --- Objects/iterobject.c 12 Apr 2004 18:10:01 -0000 1.18 +++ Objects/iterobject.c 1 Sep 2004 04:20:03 -0000 @@ -192,18 +192,14 @@ return result; /* Common case, fast path */ Py_DECREF(result); if (ok > 0) { - Py_DECREF(it->it_callable); - it->it_callable = NULL; - Py_DECREF(it->it_sentinel); - it->it_sentinel = NULL; + Py_CLEAR(it->it_callable); + Py_CLEAR(it->it_sentinel); } } else if (PyErr_ExceptionMatches(PyExc_StopIteration)) { PyErr_Clear(); - Py_DECREF(it->it_callable); - it->it_callable = NULL; - Py_DECREF(it->it_sentinel); - it->it_sentinel = NULL; + Py_CLEAR(it->it_callable); + Py_CLEAR(it->it_sentinel); } } return NULL;