7.1.1 Type Objects
Keywords: api

##
7.1.1 Type Objects

`PyTypeObject`
  The C structure of the objects used to describe built-in types.

PyObject* `PyType_Type`
  This is the type object for type objects; it is the same object as `types.TypeType` in the Python layer.

int `PyType_Check`(PyObject *o)
  Returns true if the object o is a type object, including instances of types derived from the standard type object. Returns false in all other cases.

int `PyType_CheckExact`(PyObject *o)
  Returns true if the object o is a type object, but not a subtype of the standard type object. Returns false in all other cases. New in version 2.2.

int `PyType_HasFeature`(PyObject *o, int feature)
  Returns true if the type object o sets the feature feature. Type features are denoted by single bit flags.

int `PyType_IS_GC`(PyObject *o)
  Return true if the type object includes support for the cycle detector; this tests the type flag `Py_TPFLAGS_HAVE_GC`. New in version 2.0.

int `PyType_IsSubtype`(PyTypeObject *a, PyTypeObject *b)
  Returns true if a is a subtype of b. New in version 2.2.

PyObject* `PyType_GenericAlloc`(PyTypeObject *type, int nitems)
  Return value: New reference.
  New in version 2.2.

PyObject* `PyType_GenericNew`(PyTypeObject *type, PyObject *args, PyObject *kwds)
  Return value: New reference.
  New in version 2.2.

int `PyType_Ready`(PyTypeObject *type)
  New in version 2.2.