diff options
author | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2002-03-29 03:05:54 (GMT) |
---|---|---|
committer | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2002-03-29 03:05:54 (GMT) |
commit | f589c059f4101f700c08841df828758b1c8dcda0 (patch) | |
tree | ee655452788e13558e68abf11d352177ee8cb14c /Objects | |
parent | b883310d59a2b44f502f191186ba40a3689d11ee (diff) | |
download | cpython-f589c059f4101f700c08841df828758b1c8dcda0.zip cpython-f589c059f4101f700c08841df828758b1c8dcda0.tar.gz cpython-f589c059f4101f700c08841df828758b1c8dcda0.tar.bz2 |
If the GC is enabled then don't use the ob_type pointer to create a list
of trash objects. Use the gc_prev pointer instead.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/object.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Objects/object.c b/Objects/object.c index 6ec8c8b..396f734 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -2037,6 +2037,7 @@ PyObject * _PyTrash_delete_later = NULL; void _PyTrash_deposit_object(PyObject *op) { +#ifndef WITH_CYCLE_GC int typecode; if (PyTuple_Check(op)) @@ -2054,8 +2055,11 @@ _PyTrash_deposit_object(PyObject *op) return; /* pacify compiler -- execution never here */ } op->ob_refcnt = typecode; - op->ob_type = (PyTypeObject*)_PyTrash_delete_later; +#else + assert (_Py_AS_GC(op)->gc.gc_next == NULL); + _Py_AS_GC(op)->gc.gc_prev = (PyGC_Head *)_PyTrash_delete_later; +#endif _PyTrash_delete_later = op; } @@ -2064,6 +2068,8 @@ _PyTrash_destroy_chain(void) { while (_PyTrash_delete_later) { PyObject *shredder = _PyTrash_delete_later; + +#ifndef WITH_CYCLE_GC _PyTrash_delete_later = (PyObject*) shredder->ob_type; switch (shredder->ob_refcnt) { @@ -2083,6 +2089,11 @@ _PyTrash_destroy_chain(void) shredder->ob_type = &PyTraceBack_Type; break; } +#else + _PyTrash_delete_later = + (PyObject*) _Py_AS_GC(shredder)->gc.gc_prev; +#endif + _Py_NewReference(shredder); ++_PyTrash_delete_nesting; |