diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2002-07-14 00:27:26 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2002-07-14 00:27:26 (GMT) |
commit | a81d220625ae5a157c3bdc72298939b56d2a6faa (patch) | |
tree | 0e429511cff57dab5525fa5ddec1ed32ca7c5133 | |
parent | b6d29b7856d25e382a024139d6599962c02b404b (diff) | |
download | cpython-a81d220625ae5a157c3bdc72298939b56d2a6faa.zip cpython-a81d220625ae5a157c3bdc72298939b56d2a6faa.tar.gz cpython-a81d220625ae5a157c3bdc72298939b56d2a6faa.tar.bz2 |
SF patch # 580411, move frame macros from frameobject.h into ceval.c
remove unused macros
use co alias instead of f->f_code in macros
-rw-r--r-- | Include/frameobject.h | 20 | ||||
-rw-r--r-- | Python/ceval.c | 13 |
2 files changed, 10 insertions, 23 deletions
diff --git a/Include/frameobject.h b/Include/frameobject.h index ac02f92..185c286 100644 --- a/Include/frameobject.h +++ b/Include/frameobject.h @@ -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); diff --git a/Python/ceval.c b/Python/ceval.c index 61db642..5122c76 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -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]) |