diff options
author | Guido van Rossum <guido@python.org> | 2000-07-01 01:00:38 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2000-07-01 01:00:38 (GMT) |
commit | 4cc6ac7b8797dd55cf9c93b6da7eae1d225b7dfe (patch) | |
tree | 33188a2be2a6d62e6f647f842303aa80ce9de474 /Include | |
parent | ce8e1dc39531c8bed47cef0dd9d05bd3e9c0bd66 (diff) | |
download | cpython-4cc6ac7b8797dd55cf9c93b6da7eae1d225b7dfe.zip cpython-4cc6ac7b8797dd55cf9c93b6da7eae1d225b7dfe.tar.gz cpython-4cc6ac7b8797dd55cf9c93b6da7eae1d225b7dfe.tar.bz2 |
Neil Schemenauer: small fixes for GC
Diffstat (limited to 'Include')
-rw-r--r-- | Include/objimpl.h | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Include/objimpl.h b/Include/objimpl.h index 665cec5..defdc9c 100644 --- a/Include/objimpl.h +++ b/Include/objimpl.h @@ -183,6 +183,8 @@ extern DL_IMPORT(void) _PyObject_Del Py_PROTO((PyObject *)); (PyVarObject *) PyObject_MALLOC( _PyObject_VAR_SIZE((typeobj),(n)) ),\ (typeobj), (n)) ) +#define PyObject_DEL(op) PyObject_FREE(op) + /* This example code implements an object constructor with a custom allocator, where PyObject_New is inlined, and shows the important distinction between two steps (at least): @@ -221,7 +223,7 @@ extern DL_IMPORT(void) _PyObject_Del Py_PROTO((PyObject *)); PyObject_{New, VarNew, Del} to manage the memory. Set the type flag Py_TPFLAGS_GC and define the type method tp_recurse. You should also add the method tp_clear if your object is mutable. Include - PyGC_INFO_SIZE in the calculation of tp_basicsize. Call + PyGC_HEAD_SIZE in the calculation of tp_basicsize. Call PyObject_GC_Init after the pointers followed by tp_recurse become valid (usually just before returning the object from the allocation method. Call PyObject_GC_Fini before those pointers become invalid @@ -234,7 +236,6 @@ extern DL_IMPORT(void) _PyObject_Del Py_PROTO((PyObject *)); #define PyObject_GC_Fini(op) #define PyObject_AS_GC(op) (op) #define PyObject_FROM_GC(op) (op) -#define PyObject_DEL(op) PyObject_FREE(op) #else @@ -268,10 +269,6 @@ typedef struct _gc_head { /* Get the object given the PyGC_Head */ #define PyObject_FROM_GC(g) ((PyObject *)(((PyGC_Head *)g)+1)) -#define PyObject_DEL(op) PyObject_FREE( PyObject_IS_GC(op) ? \ - (ANY *)PyObject_AS_GC(op) : \ - (ANY *)(op) ) - #endif /* WITH_CYCLE_GC */ #ifdef __cplusplus |