1 2 cdef extern from "Python.h": 3 # The C structure of the objects used to describe built-in types. 4 5 ############################################################################ 6 # 7.1.1 Type Objects 7 ############################################################################ 8 9 ctypedef class __builtin__.type [object PyTypeObject]: 10 pass 11 12 # PyObject* PyType_Type 13 # This is the type object for type objects; it is the same object 14 # as type and types.TypeType in the Python layer. 15 16 bint PyType_Check(object o) 17 # Return true if the object o is a type object, including 18 # instances of types derived from the standard type object. Return 19 # false in all other cases. 20 21 bint PyType_CheckExact(object o) 22 # Return true if the object o is a type object, but not a subtype 23 # of the standard type object. Return false in all other 24 # cases. 25 26 bint PyType_HasFeature(object o, int feature) 27 # Return true if the type object o sets the feature feature. Type 28 # features are denoted by single bit flags. 29 30 bint PyType_IS_GC(object o) 31 # Return true if the type object includes support for the cycle 32 # detector; this tests the type flag Py_TPFLAGS_HAVE_GC. 33 34 bint PyType_IsSubtype(type a, type b) 35 # Return true if a is a subtype of b. 36 37 object PyType_GenericAlloc(object type, Py_ssize_t nitems) 38 # Return value: New reference. 39 40 object PyType_GenericNew(type type, object args, object kwds) 41 # Return value: New reference. 42 43 bint PyType_Ready(type type) except -1 44 # Finalize a type object. This should be called on all type 45 # objects to finish their initialization. This function is 46 # responsible for adding inherited slots from a type's base 47 # class. Return 0 on success, or return -1 and sets an exception 48 # on error. 49