[Python-checkins] cpython (merge 3.5 -> default): Issue #23710: Merge from 3.5

berker.peksag python-checkins at python.org
Wed Aug 3 05:58:20 EDT 2016


https://hg.python.org/cpython/rev/26dd6e7f1733
changeset:   102516:26dd6e7f1733
parent:      102513:167974512561
parent:      102515:92b468020e07
user:        Berker Peksag <berker.peksag at gmail.com>
date:        Wed Aug 03 12:59:16 2016 +0300
summary:
  Issue #23710: Merge from 3.5

files:
  Doc/extending/newtypes.rst |  14 +++++++++-----
  1 files changed, 9 insertions(+), 5 deletions(-)


diff --git a/Doc/extending/newtypes.rst b/Doc/extending/newtypes.rst
--- a/Doc/extending/newtypes.rst
+++ b/Doc/extending/newtypes.rst
@@ -52,11 +52,15 @@
    } noddy_NoddyObject;
 
 This is what a Noddy object will contain---in this case, nothing more than what
-every Python object contains---a refcount and a pointer to a type object.
-These are the fields the ``PyObject_HEAD`` macro brings in.  The reason for the
-macro is to standardize the layout and to enable special debugging fields in
-debug builds.  Note that there is no semicolon after the ``PyObject_HEAD``
-macro; one is included in the macro definition.  Be wary of adding one by
+every Python object contains---a field called ``ob_base`` of type
+:c:type:`PyObject`.  :c:type:`PyObject` in turn, contains an ``ob_refcnt``
+field and a pointer to a type object.  These can be accessed using the macros
+:c:macro:`Py_REFCNT` and :c:macro:`Py_TYPE` respectively.  These are the fields
+the :c:macro:`PyObject_HEAD` macro brings in.  The reason for the macro is to
+standardize the layout and to enable special debugging fields in debug builds.
+
+Note that there is no semicolon after the :c:macro:`PyObject_HEAD` macro;
+one is included in the macro definition.  Be wary of adding one by
 accident; it's easy to do from habit, and your compiler might not complain,
 but someone else's probably will!  (On Windows, MSVC is known to call this an
 error and refuse to compile the code.)

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list