summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-07-01 01:00:38 (GMT)
committerGuido van Rossum <guido@python.org>2000-07-01 01:00:38 (GMT)
commit4cc6ac7b8797dd55cf9c93b6da7eae1d225b7dfe (patch)
tree33188a2be2a6d62e6f647f842303aa80ce9de474 /Objects
parentce8e1dc39531c8bed47cef0dd9d05bd3e9c0bd66 (diff)
downloadcpython-4cc6ac7b8797dd55cf9c93b6da7eae1d225b7dfe.zip
cpython-4cc6ac7b8797dd55cf9c93b6da7eae1d225b7dfe.tar.gz
cpython-4cc6ac7b8797dd55cf9c93b6da7eae1d225b7dfe.tar.bz2
Neil Schemenauer: small fixes for GC
Diffstat (limited to 'Objects')
-rw-r--r--Objects/classobject.c4
-rw-r--r--Objects/dictobject.c1
-rw-r--r--Objects/funcobject.c1
-rw-r--r--Objects/listobject.c1
-rw-r--r--Objects/object.c11
-rw-r--r--Objects/tupleobject.c3
6 files changed, 14 insertions, 7 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c
index 4a7de7b..4f73ff8 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -128,6 +128,7 @@ class_dealloc(op)
Py_XDECREF(op->cl_getattr);
Py_XDECREF(op->cl_setattr);
Py_XDECREF(op->cl_delattr);
+ op = (PyClassObject *) PyObject_AS_GC(op);
PyObject_DEL(op);
}
@@ -473,6 +474,7 @@ PyInstance_New(class, arg, kw)
inst->in_dict = PyDict_New();
PyObject_GC_Init(inst);
if (inst->in_dict == NULL) {
+ inst = (PyInstanceObject *) PyObject_AS_GC(inst);
PyObject_DEL(inst);
return NULL;
}
@@ -588,6 +590,7 @@ instance_dealloc(inst)
#endif /* Py_TRACE_REFS */
Py_DECREF(inst->in_class);
Py_XDECREF(inst->in_dict);
+ inst = (PyInstanceObject *) PyObject_AS_GC(inst);
PyObject_DEL(inst);
}
@@ -1763,6 +1766,7 @@ PyMethod_Fini()
while (free_list) {
PyMethodObject *im = free_list;
free_list = (PyMethodObject *)(im->im_self);
+ im = (PyMethodObject *) PyObject_AS_GC(im);
PyObject_DEL(im);
}
}
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index fd0ad10..60945f0 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -472,6 +472,7 @@ dict_dealloc(mp)
}
if (mp->ma_table != NULL)
PyMem_DEL(mp->ma_table);
+ mp = (dictobject *) PyObject_AS_GC(mp);
PyObject_DEL(mp);
Py_TRASHCAN_SAFE_END(mp)
}
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index 289a29f..b6c0089 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -172,6 +172,7 @@ func_dealloc(op)
Py_DECREF(op->func_name);
Py_XDECREF(op->func_defaults);
Py_XDECREF(op->func_doc);
+ op = (PyFunctionObject *) PyObject_AS_GC(op);
PyObject_DEL(op);
}
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 2cf381f..d260a88 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -209,6 +209,7 @@ list_dealloc(op)
}
PyMem_FREE(op->ob_item);
}
+ op = (PyListObject *) PyObject_AS_GC(op);
PyObject_DEL(op);
Py_TRASHCAN_SAFE_END(op)
}
diff --git a/Objects/object.c b/Objects/object.c
index 4479e7d..3052d38 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -171,14 +171,11 @@ _PyObject_Del(op)
PyObject *op;
{
#ifdef WITH_CYCLE_GC
- if (PyType_IS_GC(op->ob_type)) {
- PyGC_Head *g = PyObject_AS_GC(op);
- PyObject_FREE(g);
- } else
-#endif
- {
- PyObject_FREE(op);
+ if (op && PyType_IS_GC(op->ob_type)) {
+ op = (PyObject *) PyObject_AS_GC(op);
}
+#endif
+ PyObject_FREE(op);
}
#ifndef WITH_CYCLE_GC
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
index f39f6c0..7ce9417 100644
--- a/Objects/tupleobject.c
+++ b/Objects/tupleobject.c
@@ -175,6 +175,7 @@ tupledealloc(op)
}
#endif
}
+ op = (PyTupleObject *) PyObject_AS_GC(op);
PyObject_DEL(op);
done:
Py_TRASHCAN_SAFE_END(op)
@@ -559,6 +560,7 @@ _PyTuple_Resize(pv, newsize, last_is_sticky)
*pv = (PyObject *) sv;
if (sv == NULL) {
PyObject_GC_Init((PyObject *)v);
+ v = (PyTupleObject *) PyObject_AS_GC(v);
PyObject_DEL(v);
PyErr_NoMemory();
return -1;
@@ -595,6 +597,7 @@ PyTuple_Fini()
while (p) {
q = p;
p = (PyTupleObject *)(p->ob_item[0]);
+ q = (PyTupleObject *) PyObject_AS_GC(q);
PyObject_DEL(q);
}
}