@@ -175,8 +175,12 @@ typedef int (*initproc)(PyObject *, PyObject *, PyObject *);
175175typedef PyObject * (* newfunc )(struct _typeobject * , PyObject * , PyObject * );
176176typedef PyObject * (* allocfunc )(struct _typeobject * , Py_ssize_t );
177177
178+ #ifdef Py_LIMITED_API
178179/* In Py_LIMITED_API, PyTypeObject is an opaque structure. */
179180typedef struct _typeobject PyTypeObject ;
181+ #else
182+ /* PyTypeObject is defined in cpython/object.h */
183+ #endif
180184
181185typedef struct {
182186 int slot ; /* slot id, see below */
@@ -196,30 +200,30 @@ PyAPI_FUNC(PyObject*) PyType_FromSpec(PyType_Spec*);
196200PyAPI_FUNC (PyObject * ) PyType_FromSpecWithBases (PyType_Spec * , PyObject * );
197201#endif
198202#if !defined(Py_LIMITED_API ) || Py_LIMITED_API + 0 >= 0x03040000
199- PyAPI_FUNC (void * ) PyType_GetSlot (PyTypeObject * , int );
203+ PyAPI_FUNC (void * ) PyType_GetSlot (struct _typeobject * , int );
200204#endif
201205
202206/* Generic type check */
203- PyAPI_FUNC (int ) PyType_IsSubtype (PyTypeObject * , PyTypeObject * );
207+ PyAPI_FUNC (int ) PyType_IsSubtype (struct _typeobject * , struct _typeobject * );
204208#define PyObject_TypeCheck (ob , tp ) \
205209 (Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))
206210
207- PyAPI_DATA (PyTypeObject ) PyType_Type ; /* built-in 'type' */
208- PyAPI_DATA (PyTypeObject ) PyBaseObject_Type ; /* built-in 'object' */
209- PyAPI_DATA (PyTypeObject ) PySuper_Type ; /* built-in 'super' */
211+ PyAPI_DATA (struct _typeobject ) PyType_Type ; /* built-in 'type' */
212+ PyAPI_DATA (struct _typeobject ) PyBaseObject_Type ; /* built-in 'object' */
213+ PyAPI_DATA (struct _typeobject ) PySuper_Type ; /* built-in 'super' */
210214
211- PyAPI_FUNC (unsigned long ) PyType_GetFlags (PyTypeObject * );
215+ PyAPI_FUNC (unsigned long ) PyType_GetFlags (struct _typeobject * );
212216
213217#define PyType_Check (op ) \
214218 PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TYPE_SUBCLASS)
215219#define PyType_CheckExact (op ) (Py_TYPE(op) == &PyType_Type)
216220
217- PyAPI_FUNC (int ) PyType_Ready (PyTypeObject * );
218- PyAPI_FUNC (PyObject * ) PyType_GenericAlloc (PyTypeObject * , Py_ssize_t );
219- PyAPI_FUNC (PyObject * ) PyType_GenericNew (PyTypeObject * ,
221+ PyAPI_FUNC (int ) PyType_Ready (struct _typeobject * );
222+ PyAPI_FUNC (PyObject * ) PyType_GenericAlloc (struct _typeobject * , Py_ssize_t );
223+ PyAPI_FUNC (PyObject * ) PyType_GenericNew (struct _typeobject * ,
220224 PyObject * , PyObject * );
221225PyAPI_FUNC (unsigned int ) PyType_ClearCache (void );
222- PyAPI_FUNC (void ) PyType_Modified (PyTypeObject * );
226+ PyAPI_FUNC (void ) PyType_Modified (struct _typeobject * );
223227
224228/* Generic operations on objects */
225229PyAPI_FUNC (PyObject * ) PyObject_Repr (PyObject * );
@@ -397,8 +401,8 @@ PyAPI_FUNC(void) _PyDebug_PrintTotalRefs(void);
397401#endif /* Py_REF_DEBUG */
398402
399403#ifdef COUNT_ALLOCS
400- PyAPI_FUNC (void ) _Py_inc_count (PyTypeObject * );
401- PyAPI_FUNC (void ) _Py_dec_count (PyTypeObject * );
404+ PyAPI_FUNC (void ) _Py_inc_count (struct _typeobject * );
405+ PyAPI_FUNC (void ) _Py_dec_count (struct _typeobject * );
402406#define _Py_INC_TPALLOCS (OP ) _Py_inc_count(Py_TYPE(OP))
403407#define _Py_INC_TPFREES (OP ) _Py_dec_count(Py_TYPE(OP))
404408#define _Py_DEC_TPFREES (OP ) Py_TYPE(OP)->tp_frees--
0 commit comments