mirror of
https://github.com/python/cpython.git
synced 2025-07-31 23:23:11 +00:00
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).
This commit is contained in:
parent
a13131cf7f
commit
de2acf6512
2 changed files with 20 additions and 22 deletions
|
@ -303,13 +303,13 @@ PyAPI_FUNC(void) PyObject_GC_Del(void *);
|
|||
* "visit" and "arg". This is intended to keep tp_traverse functions
|
||||
* looking as much alike as possible.
|
||||
*/
|
||||
#define Py_VISIT(op) \
|
||||
do { \
|
||||
if (op) { \
|
||||
int vret = visit((op), arg); \
|
||||
if (vret) \
|
||||
return vret; \
|
||||
} \
|
||||
#define Py_VISIT(op) \
|
||||
do { \
|
||||
if (op) { \
|
||||
int vret = visit((PyObject *)(op), arg); \
|
||||
if (vret) \
|
||||
return vret; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* This is here for the sake of backwards compatibility. Extensions that
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue