File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -265,7 +265,7 @@ allocation and deallocation. At a minimum, we need a deallocation method::
265265 {
266266 Py_XDECREF(self->first);
267267 Py_XDECREF(self->last);
268- self->ob_type ->tp_free((PyObject*)self);
268+ Py_TYPE( self) ->tp_free((PyObject*)self);
269269 }
270270
271271which is assigned to the :attr: `tp_dealloc ` member::
@@ -759,7 +759,7 @@ to use it::
759759 Noddy_dealloc(Noddy* self)
760760 {
761761 Noddy_clear(self);
762- self->ob_type ->tp_free((PyObject*)self);
762+ Py_TYPE( self) ->tp_free((PyObject*)self);
763763 }
764764
765765Notice 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::
952952 newdatatype_dealloc(newdatatypeobject * obj)
953953 {
954954 free(obj->obj_UnderlyingDatatypePtr);
955- obj->ob_type ->tp_free(obj);
955+ Py_TYPE( obj) ->tp_free(obj);
956956 }
957957
958958.. index ::
@@ -995,7 +995,7 @@ done. This can be done using the :cfunc:`PyErr_Fetch` and
995995
996996 Py_DECREF(self->my_callback);
997997 }
998- obj->ob_type ->tp_free((PyObject*)self);
998+ Py_TYPE( obj) ->tp_free((PyObject*)self);
999999 }
10001000
10011001
You can’t perform that action at this time.
0 commit comments