mirror of
https://github.com/python/cpython.git
synced 2025-08-22 01:35:16 +00:00
bpo-35059: Add _PyObject_CAST() macro (GH-10645)
Add _PyObject_CAST() and _PyVarObject_CAST() macros to cast argument to PyObject* and PyVarObject* properly.
This commit is contained in:
parent
271753a27a
commit
2ff8fb7639
5 changed files with 29 additions and 23 deletions
|
@ -258,7 +258,7 @@ PyAPI_FUNC(Py_ssize_t) _PyGC_CollectIfEnabled(void);
|
|||
|
||||
PyAPI_FUNC(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, Py_ssize_t);
|
||||
#define PyObject_GC_Resize(type, op, n) \
|
||||
( (type *) _PyObject_GC_Resize((PyVarObject *)(op), (n)) )
|
||||
( (type *) _PyObject_GC_Resize(_PyVarObject_CAST(op), (n)) )
|
||||
|
||||
|
||||
#ifndef Py_LIMITED_API
|
||||
|
@ -356,7 +356,7 @@ PyAPI_FUNC(void) PyObject_GC_Del(void *);
|
|||
#define Py_VISIT(op) \
|
||||
do { \
|
||||
if (op) { \
|
||||
int vret = visit((PyObject *)(op), arg); \
|
||||
int vret = visit(_PyObject_CAST(op), arg); \
|
||||
if (vret) \
|
||||
return vret; \
|
||||
} \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue