summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorINADA Naoki <methane@users.noreply.github.com>2018-07-10 08:19:53 (GMT)
committerGitHub <noreply@github.com>2018-07-10 08:19:53 (GMT)
commit5ac9e6eee5ed18172d70d28cf438df0be4e3b83d (patch)
treeb2bce47540d64667dea6e872148ea5529a654d18 /Objects
parent445f1b35ce8461268438c8a6b327ddc764287e05 (diff)
downloadcpython-5ac9e6eee5ed18172d70d28cf438df0be4e3b83d.zip
cpython-5ac9e6eee5ed18172d70d28cf438df0be4e3b83d.tar.gz
cpython-5ac9e6eee5ed18172d70d28cf438df0be4e3b83d.tar.bz2
bpo-33597: Reduce PyGC_Head size (GH-7043)
Diffstat (limited to 'Objects')
-rw-r--r--Objects/object.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/Objects/object.c b/Objects/object.c
index 3eb4810..2471f6b 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -284,8 +284,9 @@ PyObject_CallFinalizer(PyObject *self)
return;
tp->tp_finalize(self);
- if (PyType_IS_GC(tp))
- _PyGC_SET_FINALIZED(self, 1);
+ if (PyType_IS_GC(tp)) {
+ _PyGC_SET_FINALIZED(self);
+ }
}
int
@@ -2095,7 +2096,7 @@ _PyTrash_deposit_object(PyObject *op)
assert(PyObject_IS_GC(op));
assert(!_PyObject_GC_IS_TRACKED(op));
assert(op->ob_refcnt == 0);
- _Py_AS_GC(op)->gc.gc_prev = (PyGC_Head *)_PyRuntime.gc.trash_delete_later;
+ _PyGCHead_SET_PREV(_Py_AS_GC(op), _PyRuntime.gc.trash_delete_later);
_PyRuntime.gc.trash_delete_later = op;
}
@@ -2107,7 +2108,7 @@ _PyTrash_thread_deposit_object(PyObject *op)
assert(PyObject_IS_GC(op));
assert(!_PyObject_GC_IS_TRACKED(op));
assert(op->ob_refcnt == 0);
- _Py_AS_GC(op)->gc.gc_prev = (PyGC_Head *) tstate->trash_delete_later;
+ _PyGCHead_SET_PREV(_Py_AS_GC(op), tstate->trash_delete_later);
tstate->trash_delete_later = op;
}
@@ -2122,7 +2123,7 @@ _PyTrash_destroy_chain(void)
destructor dealloc = Py_TYPE(op)->tp_dealloc;
_PyRuntime.gc.trash_delete_later =
- (PyObject*) _Py_AS_GC(op)->gc.gc_prev;
+ (PyObject*) _PyGCHead_PREV(_Py_AS_GC(op));
/* Call the deallocator directly. This used to try to
* fool Py_DECREF into calling it indirectly, but
@@ -2160,7 +2161,7 @@ _PyTrash_thread_destroy_chain(void)
destructor dealloc = Py_TYPE(op)->tp_dealloc;
tstate->trash_delete_later =
- (PyObject*) _Py_AS_GC(op)->gc.gc_prev;
+ (PyObject*) _PyGCHead_PREV(_Py_AS_GC(op));
/* Call the deallocator directly. This used to try to
* fool Py_DECREF into calling it indirectly, but