summaryrefslogtreecommitdiffstats
path: root/Objects/object.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/object.c')
-rw-r--r--Objects/object.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/Objects/object.c b/Objects/object.c
index 3e61282..6fc1146 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -2131,11 +2131,14 @@ finally:
void
_PyTrash_deposit_object(PyObject *op)
{
+ PyThreadState *tstate = _PyThreadState_GET();
+ struct _gc_runtime_state *gcstate = &tstate->interp->gc;
+
_PyObject_ASSERT(op, PyObject_IS_GC(op));
_PyObject_ASSERT(op, !_PyObject_GC_IS_TRACKED(op));
_PyObject_ASSERT(op, op->ob_refcnt == 0);
- _PyGCHead_SET_PREV(_Py_AS_GC(op), _PyRuntime.gc.trash_delete_later);
- _PyRuntime.gc.trash_delete_later = op;
+ _PyGCHead_SET_PREV(_Py_AS_GC(op), gcstate->trash_delete_later);
+ gcstate->trash_delete_later = op;
}
/* The equivalent API, using per-thread state recursion info */
@@ -2156,11 +2159,14 @@ _PyTrash_thread_deposit_object(PyObject *op)
void
_PyTrash_destroy_chain(void)
{
- while (_PyRuntime.gc.trash_delete_later) {
- PyObject *op = _PyRuntime.gc.trash_delete_later;
+ PyThreadState *tstate = _PyThreadState_GET();
+ struct _gc_runtime_state *gcstate = &tstate->interp->gc;
+
+ while (gcstate->trash_delete_later) {
+ PyObject *op = gcstate->trash_delete_later;
destructor dealloc = Py_TYPE(op)->tp_dealloc;
- _PyRuntime.gc.trash_delete_later =
+ gcstate->trash_delete_later =
(PyObject*) _PyGCHead_PREV(_Py_AS_GC(op));
/* Call the deallocator directly. This used to try to
@@ -2170,9 +2176,9 @@ _PyTrash_destroy_chain(void)
* up distorting allocation statistics.
*/
_PyObject_ASSERT(op, op->ob_refcnt == 0);
- ++_PyRuntime.gc.trash_delete_nesting;
+ ++gcstate->trash_delete_nesting;
(*dealloc)(op);
- --_PyRuntime.gc.trash_delete_nesting;
+ --gcstate->trash_delete_nesting;
}
}