diff -r 682a8e36dd18 Doc/extending/newtypes.rst --- a/Doc/extending/newtypes.rst Tue Jul 05 17:08:52 2016 +0300 +++ b/Doc/extending/newtypes.rst Wed Jul 06 15:38:57 2016 -0700 @@ -52,14 +52,20 @@ } 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. +every Python object contains---a field called ``ob_base`` of type :c:type:`PyObject`. +PyObject in turn, contains a refcount and a pointer to a type object. These can +be accessed using the macros :c:macro:`Py_TYPE` and :c:macro:`Py_REFCNT`. 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 -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.) +debug builds. More information can be found on the :c:type:`PyObject` type page. + +.. warning:: + + There is no semicolon after the ``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.) For contrast, let's take a look at the corresponding definition for standard Python floats::