diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2000-06-30 05:02:53 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2000-06-30 05:02:53 (GMT) |
commit | c5007aa5c3d64109578cf12b026ca6305acff97b (patch) | |
tree | a576fb8432ea60a6b6db49c09937551903938003 /Objects/dictobject.c | |
parent | 4e542a3d9995addd08e7675a63cb0c8ee61a5010 (diff) | |
download | cpython-c5007aa5c3d64109578cf12b026ca6305acff97b.zip cpython-c5007aa5c3d64109578cf12b026ca6305acff97b.tar.gz cpython-c5007aa5c3d64109578cf12b026ca6305acff97b.tar.bz2 |
final patches from Neil Schemenauer for garbage collection
Diffstat (limited to 'Objects/dictobject.c')
-rw-r--r-- | Objects/dictobject.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c index ce38f11..ea3af48 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -129,6 +129,7 @@ PyDict_New() mp->ma_table = NULL; mp->ma_fill = 0; mp->ma_used = 0; + PyObject_GC_Init(mp); return (PyObject *)mp; } @@ -481,6 +482,7 @@ dict_dealloc(mp) register int i; register dictentry *ep; Py_TRASHCAN_SAFE_BEGIN(mp) + PyObject_GC_Fini(mp); for (i = 0, ep = mp->ma_table; i < mp->ma_size; i++, ep++) { if (ep->me_key != NULL) { Py_DECREF(ep->me_key); @@ -1087,7 +1089,7 @@ PyTypeObject PyDict_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "dictionary", - sizeof(dictobject) + PyGC_INFO_SIZE, + sizeof(dictobject) + PyGC_HEAD_SIZE, 0, (destructor)dict_dealloc, /*tp_dealloc*/ (printfunc)dict_print, /*tp_print*/ |