Common Object Structures — Python 3.14.7 documentation

docs.python.org

Tin mới

Type Object Structures

Python Module Index

3.14.7 Documentation

Python/C API reference manual

Object Implementation Support

reference counting

All Python objects ultimately share a small number of fields at the beginning of the object’s representation in memory. These are represented by the PyObject and PyVarObject types, which are defined, in turn, by the expa

PyObject_SetAttrString()

Set the type of object o to type, without any checking or reference counting.

PyArg_ParseTuple()

This is the typical calling convention, where the methods have the type PyCFunction. The function expects two PyObject* values. The first one is the self object for methods; for module functions, it is the module object.

vectorcall protocol

object.__contains__

types.BuiltinMethodType

The type object corresponding to Python C method objects. This is available as types.BuiltinMethodType in the Python layer.

borrowed reference

Get the “self” object on func. This is the object that would be passed to the first argument of a PyCFunction. For C function objects created through a PyMethodDef on a PyModuleDef, this is the resulting module object.

PyType_Spec.basicsize

Indicates that the offset of this PyMemberDef entry indicates an offset from the subclass-specific data, rather than from PyObject.