summaryrefslogtreecommitdiff
path: root/Include/objimpl.h
diff options
context:
space:
mode:
Diffstat (limited to 'Include/objimpl.h')
-rw-r--r--Include/objimpl.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/Include/objimpl.h b/Include/objimpl.h
index 1c50d8bd6c..aee3fdc374 100644
--- a/Include/objimpl.h
+++ b/Include/objimpl.h
@@ -145,7 +145,7 @@ PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, Py_ssize_t);
These inline functions expect non-NULL object pointers. */
static inline PyObject*
-PyObject_INIT(PyObject *op, PyTypeObject *typeobj)
+_PyObject_INIT(PyObject *op, PyTypeObject *typeobj)
{
assert(op != NULL);
Py_TYPE(op) = typeobj;
@@ -153,8 +153,11 @@ PyObject_INIT(PyObject *op, PyTypeObject *typeobj)
return op;
}
+#define PyObject_INIT(op, typeobj) \
+ _PyObject_INIT(_PyObject_CAST(op), (typeobj))
+
static inline PyVarObject*
-PyObject_INIT_VAR(PyVarObject *op, PyTypeObject *typeobj, Py_ssize_t size)
+_PyObject_INIT_VAR(PyVarObject *op, PyTypeObject *typeobj, Py_ssize_t size)
{
assert(op != NULL);
Py_SIZE(op) = size;
@@ -162,6 +165,9 @@ PyObject_INIT_VAR(PyVarObject *op, PyTypeObject *typeobj, Py_ssize_t size)
return op;
}
+#define PyObject_INIT_VAR(op, typeobj, size) \
+ _PyObject_INIT_VAR(_PyVarObject_CAST(op), (typeobj), (size))
+
#define _PyObject_SIZE(typeobj) ( (typeobj)->tp_basicsize )
/* _PyObject_VAR_SIZE returns the number of bytes (as size_t) allocated for a