[Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.109,2.110
Neil Schemenauer
nascheme@users.sourceforge.net
2001年8月29日 16:51:54 -0700
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv3263/Objects
Modified Files:
dictobject.c
Log Message:
Use new GC API.
Index: dictobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v
retrieving revision 2.109
retrieving revision 2.110
diff -C2 -d -r2.109 -r2.110
*** dictobject.c 2001年08月16日 13:15:00 2.109
--- dictobject.c 2001年08月29日 23:51:52 2.110
***************
*** 159,163 ****
#endif
}
! mp = PyObject_NEW(dictobject, &PyDict_Type);
if (mp == NULL)
return NULL;
--- 159,163 ----
#endif
}
! mp = PyObject_GC_New(dictobject, &PyDict_Type);
if (mp == NULL)
return NULL;
***************
*** 167,171 ****
++created;
#endif
! PyObject_GC_Init(mp);
return (PyObject *)mp;
}
--- 167,171 ----
++created;
#endif
! _PyObject_GC_TRACK(mp);
return (PyObject *)mp;
}
***************
*** 693,697 ****
int fill = mp->ma_fill;
Py_TRASHCAN_SAFE_BEGIN(mp)
! PyObject_GC_Fini(mp);
for (ep = mp->ma_table; fill > 0; ep++) {
if (ep->me_key) {
--- 693,697 ----
int fill = mp->ma_fill;
Py_TRASHCAN_SAFE_BEGIN(mp)
! _PyObject_GC_UNTRACK(mp);
for (ep = mp->ma_table; fill > 0; ep++) {
if (ep->me_key) {
***************
*** 703,708 ****
if (mp->ma_table != mp->ma_smalltable)
PyMem_DEL(mp->ma_table);
! mp = (dictobject *) PyObject_AS_GC(mp);
! PyObject_DEL(mp);
Py_TRASHCAN_SAFE_END(mp)
}
--- 703,707 ----
if (mp->ma_table != mp->ma_smalltable)
PyMem_DEL(mp->ma_table);
! PyObject_GC_Del(mp);
Py_TRASHCAN_SAFE_END(mp)
}
***************
*** 1704,1708 ****
0,
"dictionary",
! sizeof(dictobject) + PyGC_HEAD_SIZE,
0,
(destructor)dict_dealloc, /* tp_dealloc */
--- 1703,1707 ----
0,
"dictionary",
! sizeof(dictobject),
0,
(destructor)dict_dealloc, /* tp_dealloc */
***************
*** 1721,1725 ****
0, /* tp_setattro */
0, /* tp_as_buffer */
! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC |
Py_TPFLAGS_BASETYPE, /* tp_flags */
"dictionary type", /* tp_doc */
--- 1720,1724 ----
0, /* tp_setattro */
0, /* tp_as_buffer */
! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
Py_TPFLAGS_BASETYPE, /* tp_flags */
"dictionary type", /* tp_doc */