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:
Victor Stinner 2018-11-22 02:57:29 +01:00 committed by GitHub
parent 271753a27a
commit 2ff8fb7639
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 23 deletions

View file

@ -42,7 +42,7 @@ static inline void _PyObject_GC_TRACK_impl(const char *filename, int lineno,
}
#define _PyObject_GC_TRACK(op) \
_PyObject_GC_TRACK_impl(__FILE__, __LINE__, (PyObject *)(op))
_PyObject_GC_TRACK_impl(__FILE__, __LINE__, _PyObject_CAST(op))
/* Tell the GC to stop tracking this object.
*
@ -70,7 +70,7 @@ static inline void _PyObject_GC_UNTRACK_impl(const char *filename, int lineno,
}
#define _PyObject_GC_UNTRACK(op) \
_PyObject_GC_UNTRACK_impl(__FILE__, __LINE__, (PyObject *)(op))
_PyObject_GC_UNTRACK_impl(__FILE__, __LINE__, _PyObject_CAST(op))
#ifdef __cplusplus
}