diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-06-26 20:58:58 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-06-26 20:58:58 (GMT) |
commit | d8e1c9e1779699b833c33515a57ba8130a555c1f (patch) | |
tree | 862e2b372fce543a021070dd835995fd034dd266 /Python | |
parent | ee13dba1aa7bc54b6b78eaed508a0f9c972204df (diff) | |
download | cpython-d8e1c9e1779699b833c33515a57ba8130a555c1f.zip cpython-d8e1c9e1779699b833c33515a57ba8130a555c1f.tar.gz cpython-d8e1c9e1779699b833c33515a57ba8130a555c1f.tar.bz2 |
Add "gi_" (generator-iterator) prefix to names of genobject members.
Makes it much easier to find references via dumb editor search (former
"frame" in particular was near-hopeless).
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 6a1ba50..e4620ab 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -111,8 +111,12 @@ staticforward PyTypeObject gentype; typedef struct { PyObject_HEAD - PyFrameObject *frame; - int running; /* true if generator is being executed */ + /* The gi_ prefix is intended to remind of generator-iterator. */ + + PyFrameObject *gi_frame; + + /* True if generator is being executed. */ + int gi_running; } genobject; static PyObject * @@ -123,15 +127,15 @@ gen_new(PyFrameObject *f) Py_DECREF(f); return NULL; } - gen->frame = f; - gen->running = 0; + gen->gi_frame = f; + gen->gi_running = 0; return (PyObject *)gen; } static void gen_dealloc(genobject *gen) { - Py_DECREF(gen->frame); + Py_DECREF(gen->gi_frame); PyObject_DEL(gen); } @@ -139,10 +143,10 @@ static PyObject * gen_iternext(genobject *gen) { PyThreadState *tstate = PyThreadState_GET(); - PyFrameObject *f = gen->frame; + PyFrameObject *f = gen->gi_frame; PyObject *result; - if (gen->running) { + if (gen->gi_running) { PyErr_SetString(PyExc_ValueError, "generator already executing"); return NULL; @@ -156,9 +160,9 @@ gen_iternext(genobject *gen) assert(f->f_back == NULL); f->f_back = tstate->frame; - gen->running = 1; + gen->gi_running = 1; result = eval_frame(f); - gen->running = 0; + gen->gi_running = 0; /* 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 |