summaryrefslogtreecommitdiffstats
path: root/Objects/frameobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1993-05-20 14:24:46 (GMT)
committerGuido van Rossum <guido@python.org>1993-05-20 14:24:46 (GMT)
commit81daa32c15cfa9f05eda037916cdbfd5b4323431 (patch)
tree82d67f6db4ff6f1ae1a682f2ec4b01d075f3e405 /Objects/frameobject.c
parent25831652fd4c03323066d4cafdc0551c396a993e (diff)
downloadcpython-81daa32c15cfa9f05eda037916cdbfd5b4323431.zip
cpython-81daa32c15cfa9f05eda037916cdbfd5b4323431.tar.gz
cpython-81daa32c15cfa9f05eda037916cdbfd5b4323431.tar.bz2
Access checks now work, at least for instance data (not for methods
yet). The class is now passed to eval_code and stored in the current frame. It is also stored in instance method objects. An "unbound" instance method is now returned when a function is retrieved through "classname.funcname", which when called passes the class to eval_code.
Diffstat (limited to 'Objects/frameobject.c')
-rw-r--r--Objects/frameobject.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index aa29795..7c2aeae 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -38,6 +38,7 @@ static struct memberlist frame_memberlist[] = {
{"f_code", T_OBJECT, OFF(f_code)},
{"f_globals", T_OBJECT, OFF(f_globals)},
{"f_locals", T_OBJECT, OFF(f_locals)},
+ {"f_class", T_OBJECT, OFF(f_class)},
/* {"f_fastlocals",T_OBJECT, OFF(f_fastlocals)}, /* XXX Unsafe */
{"f_localmap", T_OBJECT, OFF(f_localmap)},
{"f_lasti", T_INT, OFF(f_lasti)},
@@ -84,6 +85,7 @@ frame_dealloc(f)
XDECREF(f->f_code);
XDECREF(f->f_globals);
XDECREF(f->f_locals);
+ XDECREF(f->f_class);
XDECREF(f->f_fastlocals);
XDECREF(f->f_localmap);
f->f_back = free_list;
@@ -108,11 +110,12 @@ typeobject Frametype = {
};
frameobject *
-newframeobject(back, code, globals, locals, nvalues, nblocks)
+newframeobject(back, code, globals, locals, class, nvalues, nblocks)
frameobject *back;
codeobject *code;
object *globals;
object *locals;
+ object *class;
int nvalues;
int nblocks;
{
@@ -121,6 +124,7 @@ newframeobject(back, code, globals, locals, nvalues, nblocks)
code == NULL || !is_codeobject(code) ||
globals == NULL || !is_dictobject(globals) ||
locals == NULL || !is_dictobject(locals) ||
+ (class != NULL && !is_classobject(class)) ||
nvalues < 0 || nblocks < 0) {
err_badcall();
return NULL;
@@ -146,6 +150,8 @@ newframeobject(back, code, globals, locals, nvalues, nblocks)
f->f_globals = globals;
INCREF(locals);
f->f_locals = locals;
+ XINCREF(class);
+ f->f_class = class;
f->f_fastlocals = NULL;
f->f_localmap = NULL;
if (nvalues > f->f_nvalues || f->f_valuestack == NULL) {