summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1993-03-29 10:43:31 (GMT)
committerGuido van Rossum <guido@python.org>1993-03-29 10:43:31 (GMT)
commit9bfef44d97d1ae24e03717e3d59024b44626a9de (patch)
tree736b9f406d27f9dc4496f103cd395fb7a97401d4 /Python/ceval.c
parent4b1302bd1d211881178618aa8f41fa4460180f2e (diff)
downloadcpython-9bfef44d97d1ae24e03717e3d59024b44626a9de.zip
cpython-9bfef44d97d1ae24e03717e3d59024b44626a9de.tar.gz
cpython-9bfef44d97d1ae24e03717e3d59024b44626a9de.tar.bz2
* Changed all copyright messages to include 1993.
* Stubs for faster implementation of local variables (not yet finished) * Added function name to code object. Print it for code and function objects. THIS MAKES THE .PYC FILE FORMAT INCOMPATIBLE (the version number has changed accordingly) * Print address of self for built-in methods * New internal functions getattro and setattro (getattr/setattr with string object arg) * Replaced "dictobject" with more powerful "mappingobject" * New per-type functio tp_hash to implement arbitrary object hashing, and hashobject() to interface to it * Added built-in functions hash(v) and hasattr(v, 'name') * classobject: made some functions static that accidentally weren't; added __hash__ special instance method to implement hash() * Added proper comparison for built-in methods and functions
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 97f38ab..64f2429 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -173,6 +173,7 @@ eval_code(co, globals, locals, arg)
register object *u;
register object *t;
register frameobject *f; /* Current frame */
+ register listobject *fastlocals = NULL;
object *trace = NULL; /* Trace function or NULL */
object *retval; /* Return value iff why == WHY_RETURN */
char *name; /* Name used by some instructions */
@@ -911,19 +912,18 @@ eval_code(co, globals, locals, arg)
break;
case STORE_ATTR:
- name = GETNAME(oparg);
+ w = GETNAMEV(oparg);
v = POP();
u = POP();
- err = setattr(v, name, u); /* v.name = u */
+ err = setattro(v, w, u); /* v.w = u */
DECREF(v);
DECREF(u);
break;
case DELETE_ATTR:
- name = GETNAME(oparg);
+ w = GETNAMEV(oparg);
v = POP();
- err = setattr(v, name, (object *)NULL);
- /* del v.name */
+ err = setattro(v, w, (object *)NULL); /* del v.w */
DECREF(v);
break;
@@ -992,6 +992,22 @@ eval_code(co, globals, locals, arg)
INCREF(x);
PUSH(x);
break;
+
+ case RESERVE_FAST:
+ if (oparg > 0) {
+ XDECREF(fastlocals);
+ x = newlistobject(oparg);
+ fastlocals = (listobject *) x;
+ }
+ break;
+
+ case LOAD_FAST:
+ /* NYI */
+ break;
+
+ case STORE_FAST:
+ /* NYI */
+ break;
case BUILD_TUPLE:
x = newtupleobject(oparg);
@@ -1025,9 +1041,9 @@ eval_code(co, globals, locals, arg)
break;
case LOAD_ATTR:
- name = GETNAME(oparg);
+ w = GETNAMEV(oparg);
v = POP();
- x = getattr(v, name);
+ x = getattro(v, w);
DECREF(v);
PUSH(x);
break;
@@ -1283,6 +1299,8 @@ eval_code(co, globals, locals, arg)
current_frame = f->f_back;
DECREF(f);
+
+ XDECREF(fastlocals);
return retval;
}