SF patch #1020188: Use Py_CLEAR where necessary to avoid crashes

(Contributed by Dima Dorfman)
This commit is contained in:
Raymond Hettinger 2004-09-01 07:02:44 +00:00
parent 410eb84a5d
commit 75ccea3777
5 changed files with 8 additions and 17 deletions

View file

@ -51,8 +51,7 @@ gen_iternext(PyGenObject *gen)
* 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. */