PyAPI_DATA(PyLongObject) _Py_TrueStruct;
/* Use these macros */
-#define Py_False ((PyObject *) &_Py_FalseStruct)
-#define Py_True ((PyObject *) &_Py_TrueStruct)
+#define Py_False _PyObject_CAST(&_Py_FalseStruct)
+#define Py_True _PyObject_CAST(&_Py_TrueStruct)
// Test if an object is the True singleton, the same as "x is True" in Python.
PyAPI_FUNC(int) Py_IsTrue(PyObject *x);
/* Deprecated since PyEval_CallObjectWithKeywords is deprecated */
#define PyEval_CallObject(callable, arg) \
- PyEval_CallObjectWithKeywords(callable, arg, (PyObject *)NULL)
+ PyEval_CallObjectWithKeywords(callable, arg, _PyObject_CAST(_Py_NULL))
Py_DEPRECATED(3.9) PyAPI_FUNC(PyObject *) PyEval_CallFunction(
PyObject *callable, const char *format, ...);
PyAPI_FUNC(const char *) PyExceptionClass_Name(PyObject *);
-#define PyExceptionInstance_Class(x) ((PyObject*)Py_TYPE(x))
+#define PyExceptionInstance_Class(x) _PyObject_CAST(Py_TYPE(x))
#define _PyBaseExceptionGroup_Check(x) \
PyObject_TypeCheck(x, (PyTypeObject *)PyExc_BaseExceptionGroup)