summaryrefslogtreecommitdiffstats
path: root/Objects/frameobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/frameobject.c')
-rw-r--r--Objects/frameobject.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index fcb5e4e..3a073b6 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -20,7 +20,6 @@ static PyMemberDef frame_memberlist[] = {
{"f_builtins", T_OBJECT, OFF(f_builtins),RO},
{"f_globals", T_OBJECT, OFF(f_globals), RO},
{"f_lasti", T_INT, OFF(f_lasti), RO},
- {"f_restricted",T_INT, OFF(f_restricted),RO},
{"f_exc_type", T_OBJECT, OFF(f_exc_type)},
{"f_exc_value", T_OBJECT, OFF(f_exc_value)},
{"f_exc_traceback", T_OBJECT, OFF(f_exc_traceback)},
@@ -341,11 +340,18 @@ frame_settrace(PyFrameObject *f, PyObject* v, void *closure)
return 0;
}
+static PyObject *
+frame_getrestricted(PyFrameObject *f, void *closure)
+{
+ return PyBool_FromLong(PyFrame_IsRestricted(f));
+}
+
static PyGetSetDef frame_getsetlist[] = {
{"f_locals", (getter)frame_getlocals, NULL, NULL},
{"f_lineno", (getter)frame_getlineno,
(setter)frame_setlineno, NULL},
{"f_trace", (getter)frame_gettrace, (setter)frame_settrace, NULL},
+ {"f_restricted",(getter)frame_getrestricted,NULL, NULL},
{0}
};
@@ -425,7 +431,7 @@ frame_dealloc(PyFrameObject *f)
Py_CLEAR(f->f_exc_traceback);
co = f->f_code;
- if (co != NULL && co->co_zombieframe == NULL)
+ if (co->co_zombieframe == NULL)
co->co_zombieframe = f;
else if (numfree < MAXFREELIST) {
++numfree;
@@ -435,7 +441,7 @@ frame_dealloc(PyFrameObject *f)
else
PyObject_GC_Del(f);
- Py_XDECREF(co);
+ Py_DECREF(co);
Py_TRASHCAN_SAFE_END(f)
}
@@ -636,6 +642,7 @@ PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals,
f->f_trace = NULL;
f->f_exc_type = f->f_exc_value = f->f_exc_traceback = NULL;
}
+ f->f_stacktop = f->f_valuestack;
f->f_builtins = builtins;
Py_XINCREF(back);
f->f_back = back;
@@ -664,10 +671,8 @@ PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals,
f->f_lasti = -1;
f->f_lineno = code->co_firstlineno;
- f->f_restricted = (builtins != tstate->interp->builtins);
f->f_iblock = 0;
- f->f_stacktop = f->f_valuestack;
_PyObject_GC_TRACK(f);
return f;
}