]> granicus.if.org Git - python/commitdiff
SF patch # 580411, move frame macros from frameobject.h into ceval.c
authorNeal Norwitz <nnorwitz@gmail.com>
Sun, 14 Jul 2002 00:27:26 +0000 (00:27 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Sun, 14 Jul 2002 00:27:26 +0000 (00:27 +0000)
remove unused macros
use co alias instead of f->f_code in macros

Include/frameobject.h
Python/ceval.c

index ac02f92386d90003fbea017ed998ef2d0f7530fc..185c28658eb3f89c1d0a4f391fb1a1998053a5ef 100644 (file)
@@ -54,26 +54,6 @@ DL_IMPORT(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *,
 
 /* The rest of the interface is specific for frame objects */
 
-/* Tuple access macros */
-
-#ifndef Py_DEBUG
-#define GETITEM(v, i) PyTuple_GET_ITEM((PyTupleObject *)(v), (i))
-#define GETITEMNAME(v, i) \
-       PyString_AS_STRING((PyStringObject *)GETITEM((v), (i)))
-#else
-#define GETITEM(v, i) PyTuple_GetItem((v), (i))
-#define GETITEMNAME(v, i) PyString_AsString(GETITEM(v, i))
-#endif
-
-#define GETUSTRINGVALUE(s) ((unsigned char *)PyString_AS_STRING(s))
-
-/* Code access macros */
-
-#define Getconst(f, i) (GETITEM((f)->f_code->co_consts, (i)))
-#define Getname(f, i)  (GETITEMNAME((f)->f_code->co_names, (i)))
-#define Getnamev(f, i) (GETITEM((f)->f_code->co_names, (i)))
-
-
 /* Block management functions */
 
 DL_IMPORT(void) PyFrame_BlockSetup(PyFrameObject *, int, int, int);
index 61db642f844e2a80c6bd231063c360d16706657c..5122c76fa4a4f145bf70d2bfdf46f3b32ab13837 100644 (file)
@@ -521,11 +521,18 @@ eval_frame(PyFrameObject *f)
        char *filename;
 #endif
 
+/* Tuple access macros */
+
+#ifndef Py_DEBUG
+#define GETITEM(v, i) PyTuple_GET_ITEM((PyTupleObject *)(v), (i))
+#else
+#define GETITEM(v, i) PyTuple_GetItem((v), (i))
+#endif
+
 /* Code access macros */
 
-#define GETCONST(i)    Getconst(f, i)
-#define GETNAME(i)     Getname(f, i)
-#define GETNAMEV(i)    Getnamev(f, i)
+#define GETCONST(i)    (GETITEM(co->co_consts, (i)))
+#define GETNAMEV(i)    (GETITEM(co->co_names, (i)))
 #define INSTR_OFFSET() (next_instr - first_instr)
 #define NEXTOP()       (*next_instr++)
 #define NEXTARG()      (next_instr += 2, (next_instr[-1]<<8) + next_instr[-2])