commit | 880430e2a54d4f47baef3515072e7119e85510f7 | [log] [tgz] |
---|---|---|
author | Raymond Hettinger <python@rcn.com> | Sat Oct 02 10:56:43 2004 +0000 |
committer | Raymond Hettinger <python@rcn.com> | Sat Oct 02 10:56:43 2004 +0000 |
tree | 2860125ad6d500186d4c55985797326f7d6807e9 | |
parent | 4c3d054d3d3fa693e4eff4574ab8e98772bd66cd [diff] |
Replace structure member before decreffing.
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c index 3da0258..4069ea2 100644 --- a/Modules/itertoolsmodule.c +++ b/Modules/itertoolsmodule.c
@@ -662,6 +662,7 @@ { PyObject *item; PyObject *it; + PyObject *tmp; while (1) { item = PyIter_Next(lz->it); @@ -681,9 +682,10 @@ it = PyObject_GetIter(lz->saved); if (it == NULL) return NULL; - Py_DECREF(lz->it); + tmp = lz->it; lz->it = it; lz->firstpass = 1; + Py_DECREF(tmp); } }