summaryrefslogtreecommitdiffstats
path: root/Objects/genobject.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-09-01 07:02:44 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-09-01 07:02:44 (GMT)
commit75ccea3777f77f001102493170490874166eb3b2 (patch)
tree31c6cc1fc38e8928475d7dd3a04fe3e3d0b0a33c /Objects/genobject.c
parent410eb84a5d4e582491701d63d154959c05a457f4 (diff)
downloadcpython-75ccea3777f77f001102493170490874166eb3b2.zip
cpython-75ccea3777f77f001102493170490874166eb3b2.tar.gz
cpython-75ccea3777f77f001102493170490874166eb3b2.tar.bz2
SF patch #1020188: Use Py_CLEAR where necessary to avoid crashes
(Contributed by Dima Dorfman)
Diffstat (limited to 'Objects/genobject.c')
-rw-r--r--Objects/genobject.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/Objects/genobject.c b/Objects/genobject.c
index 66a5106..174c697 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -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. */