diff --git a/Include/object.h b/Include/object.h index 3566c736a535c4..ac8017aa530acc 100644 --- a/Include/object.h +++ b/Include/object.h @@ -102,11 +102,11 @@ typedef struct _typeobject PyTypeObject; * by hand. Similarly every pointer to a variable-size Python object can, * in addition, be cast to PyVarObject*. */ -typedef struct _object { +struct _object { _PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt; PyTypeObject *ob_type; -} PyObject; +}; /* Cast argument to PyObject* type. */ #define _PyObject_CAST(op) ((PyObject*)(op)) diff --git a/Include/pybuffer.h b/Include/pybuffer.h index 31795b780710fa..923006cff36233 100644 --- a/Include/pybuffer.h +++ b/Include/pybuffer.h @@ -6,6 +6,10 @@ extern "C" { #endif +// Forward declaration to be able to include pybuffer.h before object.h: +// pybuffer.h uses PyObject and object.h uses Py_buffer. +typedef struct _object PyObject; + #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030b0000 /* === New Buffer API ============================================ @@ -17,10 +21,6 @@ extern "C" { * */ -// Forward declaration to be able to include pybuffer.h before object.h: -// pybuffer.h uses PyObject and object.h uses Py_buffer. -typedef struct _object PyObject; - typedef struct { void *buf; PyObject *obj; /* owned reference */