Commit de2acf65 authored by Tim Peters's avatar Tim Peters

frame_traverse(): Use the standard Py_VISIT macro.

Py_VISIT:  cast the `op` argument to PyObject* when calling
`visit()`.  Else the caller has to pay too much attention to
this silly detail (e.g., frame_traverse needs to traverse
`struct _frame *` and `PyCodeObject *` pointers too).
parent a13131cf
...@@ -306,7 +306,7 @@ PyAPI_FUNC(void) PyObject_GC_Del(void *); ...@@ -306,7 +306,7 @@ PyAPI_FUNC(void) PyObject_GC_Del(void *);
#define Py_VISIT(op) \ #define Py_VISIT(op) \
do { \ do { \
if (op) { \ if (op) { \
int vret = visit((op), arg); \ int vret = visit((PyObject *)(op), arg); \
if (vret) \ if (vret) \
return vret; \ return vret; \
} \ } \
......
...@@ -422,30 +422,28 @@ static int ...@@ -422,30 +422,28 @@ static int
frame_traverse(PyFrameObject *f, visitproc visit, void *arg) frame_traverse(PyFrameObject *f, visitproc visit, void *arg)
{ {
PyObject **fastlocals, **p; PyObject **fastlocals, **p;
int i, err, slots; int i, slots;
#define VISIT(o) if (o) {if ((err = visit((PyObject *)(o), arg))) return err;}
Py_VISIT(f->f_back);
VISIT(f->f_back); Py_VISIT(f->f_code);
VISIT(f->f_code); Py_VISIT(f->f_builtins);
VISIT(f->f_builtins); Py_VISIT(f->f_globals);
VISIT(f->f_globals); Py_VISIT(f->f_locals);
VISIT(f->f_locals); Py_VISIT(f->f_trace);
VISIT(f->f_trace); Py_VISIT(f->f_exc_type);
VISIT(f->f_exc_type); Py_VISIT(f->f_exc_value);
VISIT(f->f_exc_value); Py_VISIT(f->f_exc_traceback);
VISIT(f->f_exc_traceback);
/* locals */ /* locals */
slots = f->f_nlocals + f->f_ncells + f->f_nfreevars; slots = f->f_nlocals + f->f_ncells + f->f_nfreevars;
fastlocals = f->f_localsplus; fastlocals = f->f_localsplus;
for (i = slots; --i >= 0; ++fastlocals) { for (i = slots; --i >= 0; ++fastlocals)
VISIT(*fastlocals); Py_VISIT(*fastlocals);
}
/* stack */ /* stack */
if (f->f_stacktop != NULL) { if (f->f_stacktop != NULL) {
for (p = f->f_valuestack; p < f->f_stacktop; p++) for (p = f->f_valuestack; p < f->f_stacktop; p++)
VISIT(*p); Py_VISIT(*p);
} }
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment