summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2004-03-21 22:29:05 (GMT)
committerArmin Rigo <arigo@tunes.org>2004-03-21 22:29:05 (GMT)
commit6fce78e07f569dc6f941000514cddab6c728f631 (patch)
treeaa4c886c33532deae6c2bf723a063406d84a9851 /Objects
parent8d9b60f1023009d3b621f31516e429ace297946b (diff)
downloadcpython-6fce78e07f569dc6f941000514cddab6c728f631.zip
cpython-6fce78e07f569dc6f941000514cddab6c728f631.tar.gz
cpython-6fce78e07f569dc6f941000514cddab6c728f631.tar.bz2
Restored revision 2.87.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/tupleobject.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
index a5e37b0..159dc44 100644
--- a/Objects/tupleobject.c
+++ b/Objects/tupleobject.c
@@ -27,7 +27,7 @@ PyObject *
PyTuple_New(register int size)
{
register PyTupleObject *op;
-
+ int i;
if (size < 0) {
PyErr_BadInternalCall();
return NULL;
@@ -68,8 +68,9 @@ PyTuple_New(register int size)
op = PyObject_GC_NewVar(PyTupleObject, &PyTuple_Type, size);
if (op == NULL)
return NULL;
- memset(op->ob_item, 0, size*sizeof(PyObject*));
}
+ for (i=0; i < size; i++)
+ op->ob_item[i] = NULL;
#if MAXSAVESIZE > 0
if (size == 0) {
free_tuples[0] = op;
@@ -164,27 +165,19 @@ tupledealloc(register PyTupleObject *op)
Py_TRASHCAN_SAFE_BEGIN(op)
if (len > 0) {
i = len;
+ while (--i >= 0)
+ Py_XDECREF(op->ob_item[i]);
#if MAXSAVESIZE > 0
if (len < MAXSAVESIZE &&
num_free_tuples[len] < MAXSAVEDTUPLES &&
op->ob_type == &PyTuple_Type)
{
- while (--i >= 0) {
- PyObject* o = op->ob_item[i];
- if (o != NULL) {
- op->ob_item[i] = NULL;
- Py_DECREF(o);
- }
- }
op->ob_item[0] = (PyObject *) free_tuples[len];
num_free_tuples[len]++;
free_tuples[len] = op;
goto done; /* return */
}
- else
#endif
- while (--i >= 0)
- Py_XDECREF(op->ob_item[i]);
}
op->ob_type->tp_free((PyObject *)op);
done: