Object Protocol — Python 3.16.0a0 documentation

docs.python.org

Tin mới

Abstract Objects Layer

Python Module Index

3.16.0a0 Documentation

Python/C API reference manual

borrowed reference

Similar to Py_GetConstant(), but return a borrowed reference.

PyFile_WriteObject()

Flag to be used with multiple functions that print the object (like PyObject_Print() and PyFile_WriteObject()). If passed, these functions use the str() of the object instead of the repr().

object.__getattr__

Exceptions that occur when this calls __getattr__() and __getattribute__() methods aren’t propagated, but instead given to sys.unraisablehook(). For proper error handling, use PyObject_HasAttrWithError(), PyObject_GetOpt

sys.unraisablehook()

Exceptions that occur when this calls __getattr__() and __getattribute__() methods aren’t propagated, but instead given to sys.unraisablehook(). For proper error handling, use PyObject_HasAttrWithError(), PyObject_GetOpt

PyUnicode_FromString()

This is the same as PyObject_SetAttr(), but attr_name is specified as a const char* UTF-8 encoded bytes string, rather than a PyObject*.

PyTypeObject.tp_setattro

PyType_Spec.basicsize

Get a pointer to subclass-specific data reserved for cls.

PyObject_GC_IsTracked()

Enable deferred reference counting on obj, if supported by the runtime. In the free-threaded build, this allows the interpreter to avoid reference count adjustments to obj, which may improve multi-threaded performance. T

weak reference object

Increments the reference count of obj if it is not zero. Returns 1 if the object’s reference count was successfully incremented. Otherwise, this function returns 0.

WeakValueDictionary

Increments the reference count of obj if it is not zero. Returns 1 if the object’s reference count was successfully incremented. Otherwise, this function returns 0.