diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-06-23 05:26:56 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-06-23 05:26:56 (GMT) |
commit | 8c96369513ded66146f9cf19678029615e29bcb7 (patch) | |
tree | 76bd8eda4dd36f653ce54cbef09ddc9bbf1b4a92 /Objects | |
parent | f5eae668a81050919293453054be392cfe4f6b8d (diff) | |
download | cpython-8c96369513ded66146f9cf19678029615e29bcb7.zip cpython-8c96369513ded66146f9cf19678029615e29bcb7.tar.gz cpython-8c96369513ded66146f9cf19678029615e29bcb7.tar.bz2 |
PyFrameObject: rename f_stackbottom to f_stacktop, since it points to
the next free valuestack slot, not to the base (in America, stacks push
and pop at the top -- they mutate at the bottom in Australia <winK>).
eval_frame(): assert that f_stacktop isn't NULL upon entry.
frame_delloc(): avoid ordered pointer comparisons involving f_stacktop
when f_stacktop is NULL.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/frameobject.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c index c38c5fb..6af4e6e 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -78,9 +78,11 @@ frame_dealloc(PyFrameObject *f) } /* Free stack */ - for (p = f->f_valuestack; p < f->f_stackbottom; p++) { - Py_XDECREF(*p); + if (f->f_stacktop != NULL) { + for (p = f->f_valuestack; p < f->f_stacktop; p++) + Py_XDECREF(*p); } + Py_XDECREF(f->f_back); Py_XDECREF(f->f_code); Py_XDECREF(f->f_builtins); @@ -226,7 +228,7 @@ PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals, f->f_localsplus[extras] = NULL; f->f_valuestack = f->f_localsplus + (f->f_nlocals + ncells + nfrees); - f->f_stackbottom = f->f_valuestack; + f->f_stacktop = f->f_valuestack; return f; } |