@@ -183,6 +183,8 @@ extern DL_IMPORT(void) _PyObject_Del Py_PROTO((PyObject *));
183183 (PyVarObject *) PyObject_MALLOC( _PyObject_VAR_SIZE((typeobj),(n)) ),\
184184 (typeobj), (n)) )
185185
186+ #define PyObject_DEL (op ) PyObject_FREE(op)
187+
186188/* This example code implements an object constructor with a custom
187189 allocator, where PyObject_New is inlined, and shows the important
188190 distinction between two steps (at least):
@@ -221,7 +223,7 @@ extern DL_IMPORT(void) _PyObject_Del Py_PROTO((PyObject *));
221223 PyObject_{New, VarNew, Del} to manage the memory. Set the type flag
222224 Py_TPFLAGS_GC and define the type method tp_recurse. You should also
223225 add the method tp_clear if your object is mutable. Include
224- PyGC_INFO_SIZE in the calculation of tp_basicsize. Call
226+ PyGC_HEAD_SIZE in the calculation of tp_basicsize. Call
225227 PyObject_GC_Init after the pointers followed by tp_recurse become
226228 valid (usually just before returning the object from the allocation
227229 method. Call PyObject_GC_Fini before those pointers become invalid
@@ -234,7 +236,6 @@ extern DL_IMPORT(void) _PyObject_Del Py_PROTO((PyObject *));
234236#define PyObject_GC_Fini (op )
235237#define PyObject_AS_GC (op ) (op)
236238#define PyObject_FROM_GC (op ) (op)
237- #define PyObject_DEL (op ) PyObject_FREE(op)
238239
239240#else
240241
@@ -268,10 +269,6 @@ typedef struct _gc_head {
268269/* Get the object given the PyGC_Head */
269270#define PyObject_FROM_GC (g ) ((PyObject *)(((PyGC_Head *)g)+1))
270271
271- #define PyObject_DEL (op ) PyObject_FREE( PyObject_IS_GC(op) ? \
272- (ANY *)PyObject_AS_GC(op) : \
273- (ANY *)(op) )
274-
275272#endif /* WITH_CYCLE_GC */
276273
277274#ifdef __cplusplus
0 commit comments