Note that the class objects described here represent old-style classes, which will go away in Python 3. When creating new types for extension modules, you will want to work with type objects (section Type Objects).
PyClassObject
PyClass_Type
types.ClassType
in the Python layer.PyClass_Check
(PyObject *o)PyClass_IsSubclass
(PyObject *klass, PyObject *base)There are very few functions specific to instance objects.
PyInstance_Type
PyInstance_Check
(PyObject *obj)PyInstance_New
(PyObject *class, PyObject *arg, PyObject *kw)Return value: New reference.
Create a new instance of a specific class. The parameters arg and kw are used as the positional and keyword parameters to the object’s constructor.
PyInstance_NewRaw
(PyObject *class, PyObject *dict)Return value: New reference.
Create a new instance of a specific class without calling its constructor.
class is the class of new object. The dict parameter will be used as the
object’s __dict__
; if NULL, a new dictionary will be created for the
instance.