diff options
author | Gregory P. Smith <greg@krypto.org> | 2016-01-22 21:17:41 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2016-01-22 21:17:41 (GMT) |
commit | 20d4f1b9e45d545cbade74180a8d295a4f201c69 (patch) | |
tree | 186436b7a0a6015431a6c80bfe7d391807c56930 /Doc | |
parent | 7791165fb36ecca2398ac81e9b6bc0248821262c (diff) | |
download | cpython-20d4f1b9e45d545cbade74180a8d295a4f201c69.zip cpython-20d4f1b9e45d545cbade74180a8d295a4f201c69.tar.gz cpython-20d4f1b9e45d545cbade74180a8d295a4f201c69.tar.bz2 |
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.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/c-api/structures.rst | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst index c193510..c6ec685 100644 --- a/Doc/c-api/structures.rst +++ b/Doc/c-api/structures.rst @@ -69,6 +69,37 @@ These macros are used in the definition of :c:type:`PyObject` and 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 |