summaryrefslogtreecommitdiffstats
path: root/Objects/frameobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-02-14 16:27:29 (GMT)
committerGuido van Rossum <guido@python.org>1997-02-14 16:27:29 (GMT)
commit7582bfb60a7027b57d79c44a5e8531a31d1a8f2a (patch)
tree4fd4f274156cb9996b24cb21adab64c85d283373 /Objects/frameobject.c
parent764d6c7acd078fd0114ee7066561d836879ae0e5 (diff)
downloadcpython-7582bfb60a7027b57d79c44a5e8531a31d1a8f2a.zip
cpython-7582bfb60a7027b57d79c44a5e8531a31d1a8f2a.tar.gz
cpython-7582bfb60a7027b57d79c44a5e8531a31d1a8f2a.tar.bz2
Kill all local variables when the frame is deallocated (moved here
from ceval.c). Wrapped a long line.
Diffstat (limited to 'Objects/frameobject.c')
-rw-r--r--Objects/frameobject.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index ae962e9..ab36e67 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -98,6 +98,15 @@ static void
frame_dealloc(f)
frameobject *f;
{
+ int i;
+ PyObject **fastlocals;
+
+ /* Kill all local variables */
+ fastlocals = f->f_localsplus;
+ for (i = f->f_nlocals; --i >= 0; ++fastlocals) {
+ XDECREF(*fastlocals);
+ }
+
XDECREF(f->f_back);
XDECREF(f->f_code);
XDECREF(f->f_builtins);
@@ -168,7 +177,8 @@ newframeobject(back, code, globals, locals)
f = free_list;
free_list = free_list->f_back;
if (f->f_nlocals + f->f_stacksize < extras) {
- f = realloc(f, sizeof(frameobject) + extras*sizeof(object *));
+ f = realloc(f, sizeof(frameobject) +
+ extras*sizeof(object *));
if (f == NULL)
return (PyFrameObject *)err_nomem();
}