diff options
author | Guido van Rossum <guido@python.org> | 1990-12-20 15:06:42 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1990-12-20 15:06:42 (GMT) |
commit | 3f5da24ea304e674a9abbdcffc4d671e32aa70f1 (patch) | |
tree | e932e31cb9381f40b7c87c377638216c043b5cfc /Objects/funcobject.c | |
parent | 226d79eb4a776dd54c9e4544b17deaf928bcef3a (diff) | |
download | cpython-3f5da24ea304e674a9abbdcffc4d671e32aa70f1.zip cpython-3f5da24ea304e674a9abbdcffc4d671e32aa70f1.tar.gz cpython-3f5da24ea304e674a9abbdcffc4d671e32aa70f1.tar.bz2 |
"Compiling" version
Diffstat (limited to 'Objects/funcobject.c')
-rw-r--r-- | Objects/funcobject.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/Objects/funcobject.c b/Objects/funcobject.c index 8850872..23236da 100644 --- a/Objects/funcobject.c +++ b/Objects/funcobject.c @@ -1,11 +1,8 @@ /* Function object implementation */ -#include <stdio.h> +#include "allobjects.h" -#include "PROTO.h" -#include "object.h" -#include "funcobject.h" -#include "objimpl.h" +#include "structmember.h" typedef struct { OB_HEAD @@ -52,8 +49,24 @@ getfuncglobals(op) /* Methods */ +#define OFF(x) offsetof(funcobject, x) + +static struct memberlist func_memberlist[] = { + {"func_code", T_OBJECT, OFF(func_code)}, + {"func_globals",T_OBJECT, OFF(func_globals)}, + {NULL} /* Sentinel */ +}; + +static object * +func_getattr(op, name) + funcobject *op; + char *name; +{ + return getmember((char *)op, func_memberlist, name); +} + static void -funcdealloc(op) +func_dealloc(op) funcobject *op; { DECREF(op->func_code); @@ -67,9 +80,9 @@ typeobject Functype = { "function", sizeof(funcobject), 0, - funcdealloc, /*tp_dealloc*/ + func_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ - 0, /*tp_getattr*/ + func_getattr, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ |