diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-06-23 05:47:56 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-06-23 05:47:56 (GMT) |
commit | 5eb4b87ae62de28b548df8480aa063862e7a02bd (patch) | |
tree | d05d6a551af76b6cbd8ec0f50021d7dcdb55967e /Python/ceval.c | |
parent | 2829f1cf99edb9f6f5f775d6b8ce8bd5b88c6ac9 (diff) | |
download | cpython-5eb4b87ae62de28b548df8480aa063862e7a02bd.zip cpython-5eb4b87ae62de28b548df8480aa063862e7a02bd.tar.gz cpython-5eb4b87ae62de28b548df8480aa063862e7a02bd.tar.bz2 |
gen_iternext(): Don't assume that the current thread state's frame is
not NULL. I don't think it can be NULL from Python code, but if using
generators via the C API I expect a NULL frame is possible.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index d6b61d5..d334775 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -152,7 +152,7 @@ gen_iternext(genobject *gen) /* Generators always return to their most recent caller, not * necessarily their creator. */ - Py_INCREF(tstate->frame); + Py_XINCREF(tstate->frame); assert(f->f_back == NULL); f->f_back = tstate->frame; @@ -163,7 +163,7 @@ gen_iternext(genobject *gen) /* Don't keep the reference to f_back any longer than necessary. It * may keep a chain of frames alive or it could create a reference * cycle. */ - Py_DECREF(f->f_back); + Py_XDECREF(f->f_back); f->f_back = NULL; return result; |