diff options
author | Raymond Hettinger <python@rcn.com> | 2004-10-02 10:56:43 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2004-10-02 10:56:43 (GMT) |
commit | 880430e2a54d4f47baef3515072e7119e85510f7 (patch) | |
tree | 2860125ad6d500186d4c55985797326f7d6807e9 /Modules/itertoolsmodule.c | |
parent | 4c3d054d3d3fa693e4eff4574ab8e98772bd66cd (diff) | |
download | cpython-880430e2a54d4f47baef3515072e7119e85510f7.zip cpython-880430e2a54d4f47baef3515072e7119e85510f7.tar.gz cpython-880430e2a54d4f47baef3515072e7119e85510f7.tar.bz2 |
Replace structure member before decreffing.
Diffstat (limited to 'Modules/itertoolsmodule.c')
-rw-r--r-- | Modules/itertoolsmodule.c | 4 |
1 files changed, 3 insertions, 1 deletions
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 @@ cycle_next(cycleobject *lz) { PyObject *item; PyObject *it; + PyObject *tmp; while (1) { item = PyIter_Next(lz->it); @@ -681,9 +682,10 @@ cycle_next(cycleobject *lz) 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); } } |