(original) (raw)
changeset: 100048:63183596db79 branch: 2.7 parent: 100045:9e13d97ceca2 user: Gregory P. Smith greg@krypto.org date: Fri Jan 22 13:17:41 2016 -0800 files: Doc/c-api/structures.rst description: Per issue21949 and issue1629: Document the Py_SIZE, Py_TYPE, Py_REFCNT macros. This was already done in the 3.5 branch; this just does the same in the 2.7 branch. diff -r 9e13d97ceca2 -r 63183596db79 Doc/c-api/structures.rst --- a/Doc/c-api/structures.rst Fri Jan 22 12:33:12 2016 +0100 +++ b/Doc/c-api/structures.rst Fri Jan 22 13:17:41 2016 -0800 @@ -69,6 +69,37 @@ expansion varies depending on the definition of :c:macro:`Py_TRACE_REFS`. +.. c:macro:: Py_TYPE(o) + + This macro is used to access the :attr:`ob_type` member of a Python object. + It expands to:: + + (((PyObject*)(o))->ob_type) + + .. versionadded:: 2.6 + + +.. c:macro:: Py_REFCNT(o) + + This macro is used to access the :attr:`ob_refcnt` member of a Python + object. + It expands to:: + + (((PyObject*)(o))->ob_refcnt) + + .. versionadded:: 2.6 + + +.. c:macro:: Py_SIZE(o) + + This macro is used to access the :attr:`ob_size` member of a Python object. + It expands to:: + + (((PyVarObject*)(o))->ob_size) + + .. versionadded:: 2.6 + + .. c:macro:: PyObject_HEAD_INIT(type) This is a macro which expands to initialization values for a new /greg@krypto.org