[Python-checkins] python/dist/src/Objects tupleobject.c,2.89,2.90

arigo at users.sourceforge.net arigo at users.sourceforge.net
Sun Mar 21 17:29:07 EST 2004


Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10474

Modified Files:
	tupleobject.c 
Log Message:
Restored revision 2.87.


Index: tupleobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v
retrieving revision 2.89
retrieving revision 2.90
diff -C2 -d -r2.89 -r2.90
*** tupleobject.c	21 Mar 2004 21:35:41 -0000	2.89
--- tupleobject.c	21 Mar 2004 22:29:05 -0000	2.90
***************
*** 28,32 ****
  {
  	register PyTupleObject *op;
! 
  	if (size < 0) {
  		PyErr_BadInternalCall();
--- 28,32 ----
  {
  	register PyTupleObject *op;
! 	int i;
  	if (size < 0) {
  		PyErr_BadInternalCall();
***************
*** 69,74 ****
  		if (op == NULL)
  			return NULL;
- 		memset(op->ob_item, 0, size*sizeof(PyObject*));
  	}
  #if MAXSAVESIZE > 0
  	if (size == 0) {
--- 69,75 ----
  		if (op == NULL)
  			return NULL;
  	}
+ 	for (i=0; i < size; i++)
+ 		op->ob_item[i] = NULL;
  #if MAXSAVESIZE > 0
  	if (size == 0) {
***************
*** 165,168 ****
--- 166,171 ----
  	if (len > 0) {
  		i = len;
+ 		while (--i >= 0)
+ 			Py_XDECREF(op->ob_item[i]);
  #if MAXSAVESIZE > 0
  		if (len < MAXSAVESIZE &&
***************
*** 170,180 ****
  		    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]++;
--- 173,176 ----
***************
*** 182,189 ****
  			goto done; /* return */
  		}
- 		else
  #endif
- 			while (--i >= 0)
- 				Py_XDECREF(op->ob_item[i]);
  	}
  	op->ob_type->tp_free((PyObject *)op);
--- 178,182 ----




More information about the Python-checkins mailing list