diff options
author | Georg Brandl <georg@python.org> | 2008-12-07 14:09:20 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-12-07 14:09:20 (GMT) |
commit | 2ed237bd221500cef36376ba658b589d444599c0 (patch) | |
tree | 5817e2bcb4c2e2495c01737a8fa4999959f89dd0 /Doc | |
parent | 8f1a77d4a62046dcc17924cb3ede83a9cbbbb850 (diff) | |
download | cpython-2ed237bd221500cef36376ba658b589d444599c0.zip cpython-2ed237bd221500cef36376ba658b589d444599c0.tar.gz cpython-2ed237bd221500cef36376ba658b589d444599c0.tar.bz2 |
#4576: fix ob_type access.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/extending/newtypes.rst | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Doc/extending/newtypes.rst b/Doc/extending/newtypes.rst index b0211b1..e6b52c5 100644 --- a/Doc/extending/newtypes.rst +++ b/Doc/extending/newtypes.rst @@ -265,7 +265,7 @@ allocation and deallocation. At a minimum, we need a deallocation method:: { Py_XDECREF(self->first); Py_XDECREF(self->last); - self->ob_type->tp_free((PyObject*)self); + Py_TYPE(self)->tp_free((PyObject*)self); } which is assigned to the :attr:`tp_dealloc` member:: @@ -759,7 +759,7 @@ to use it:: Noddy_dealloc(Noddy* self) { Noddy_clear(self); - self->ob_type->tp_free((PyObject*)self); + Py_TYPE(self)->tp_free((PyObject*)self); } Notice the use of a temporary variable in :cfunc:`Noddy_clear`. We use the @@ -952,7 +952,7 @@ needs to be freed here as well. Here is an example of this function:: newdatatype_dealloc(newdatatypeobject * obj) { free(obj->obj_UnderlyingDatatypePtr); - obj->ob_type->tp_free(obj); + Py_TYPE(obj)->tp_free(obj); } .. index:: @@ -995,7 +995,7 @@ done. This can be done using the :cfunc:`PyErr_Fetch` and Py_DECREF(self->my_callback); } - obj->ob_type->tp_free((PyObject*)self); + Py_TYPE(obj)->tp_free((PyObject*)self); } |