summaryrefslogtreecommitdiffstats
path: root/Objects/listobject.c
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2000-06-23 19:37:02 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2000-06-23 19:37:02 (GMT)
commitd08b4c4524a31695d7e63768c02f472c9cb54fbd (patch)
treeb81cade431fa30d6446fef0122a3796b0876c8a2 /Objects/listobject.c
parentd22162bac7e42ccf90571ee2607c9c42ed2df3fe (diff)
downloadcpython-d08b4c4524a31695d7e63768c02f472c9cb54fbd.zip
cpython-d08b4c4524a31695d7e63768c02f472c9cb54fbd.tar.gz
cpython-d08b4c4524a31695d7e63768c02f472c9cb54fbd.tar.bz2
part 2 of Neil Schemenauer's GC patches:
This patch modifies the type structures of objects that participate in GC. The object's tp_basicsize is increased when GC is enabled. GC information is prefixed to the object to maintain binary compatibility. GC objects also define the tp_flag Py_TPFLAGS_GC.
Diffstat (limited to 'Objects/listobject.c')
-rw-r--r--Objects/listobject.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 65dfb18..e9f12ab 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -71,7 +71,8 @@ PyList_New(size)
return PyErr_NoMemory();
}
/* PyObject_NewVar is inlined */
- op = (PyListObject *) PyObject_MALLOC(sizeof(PyListObject));
+ op = (PyListObject *) PyObject_MALLOC(sizeof(PyListObject)
+ + PyGC_INFO_SIZE);
if (op == NULL) {
return PyErr_NoMemory();
}
@@ -1497,7 +1498,7 @@ PyTypeObject PyList_Type = {
PyObject_HEAD_INIT(&PyType_Type)
0,
"list",
- sizeof(PyListObject),
+ sizeof(PyListObject) + PyGC_INFO_SIZE,
0,
(destructor)list_dealloc, /*tp_dealloc*/
(printfunc)list_print, /*tp_print*/
@@ -1514,7 +1515,7 @@ PyTypeObject PyList_Type = {
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /*tp_flags*/
0, /* tp_doc */
(traverseproc)list_traverse, /* tp_traverse */
(inquiry)list_clear, /* tp_clear */
@@ -1576,7 +1577,7 @@ static PyTypeObject immutable_list_type = {
PyObject_HEAD_INIT(&PyType_Type)
0,
"list (immutable, during sort)",
- sizeof(PyListObject),
+ sizeof(PyListObject) + PyGC_INFO_SIZE,
0,
0, /*tp_dealloc*/ /* Cannot happen */
(printfunc)list_print, /*tp_print*/
@@ -1593,7 +1594,7 @@ static PyTypeObject immutable_list_type = {
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /*tp_flags*/
0, /* tp_doc */
(traverseproc)list_traverse, /* tp_traverse */
};