Mercurial > cpython-lru_cache-weakref
diff Python/ceval.c @ 18239:a1ef43a6d6e1 legacy-trunk
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.
| author | Tim Peters <tim.peters@gmail.com> |
|---|---|
| date | Sat, 23 Jun 2001 05:47:56 +0000 |
| parents | f02605b8fdc1 |
| children | 47717e5667eb |
line wrap: on
line diff
--- a/Python/ceval.c Sat Jun 23 05:27:20 2001 +0000 +++ b/Python/ceval.c Sat Jun 23 05:47:56 2001 +0000 @@ -152,7 +152,7 @@ /* 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 @@ /* 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;
