[Python-checkins] CVS: python/dist/src/Objects tupleobject.c,2.56,2.57

Guido van Rossum gvanrossum@users.sourceforge.net
2001年8月30日 11:31:32 -0700


Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv1110
Modified Files:
	tupleobject.c 
Log Message:
More stuff discovered while writing the simplest of testcases:
tupledealloc(): only feed the free list when the type is really a
tuple, not a subtype. Otherwise, use PyObject_GC_Del().
_PyTuple_Resize(): disallow using this for tuple subtypes.
Index: tupleobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v
retrieving revision 2.56
retrieving revision 2.57
diff -C2 -d -r2.56 -r2.57
*** tupleobject.c	2001年08月30日 03:11:59	2.56
--- tupleobject.c	2001年08月30日 18:31:30	2.57
***************
*** 147,151 ****
 			Py_XDECREF(op->ob_item[i]);
 #if MAXSAVESIZE > 0
! 		if (len < MAXSAVESIZE && num_free_tuples[len] < MAXSAVEDTUPLES) {
 			op->ob_item[0] = (PyObject *) free_tuples[len];
 			num_free_tuples[len]++;
--- 147,154 ----
 			Py_XDECREF(op->ob_item[i]);
 #if MAXSAVESIZE > 0
! 		if (len < MAXSAVESIZE &&
! 		 num_free_tuples[len] < MAXSAVEDTUPLES &&
! 		 op->ob_type == &PyTuple_Type)
! 		{
 			op->ob_item[0] = (PyObject *) free_tuples[len];
 			num_free_tuples[len]++;
***************
*** 595,599 ****
 
 	v = (PyTupleObject *) *pv;
! 	if (v == NULL || !PyTuple_Check(v) ||
 	 (v->ob_size != 0 && v->ob_refcnt != 1)) {
 		*pv = 0;
--- 598,602 ----
 
 	v = (PyTupleObject *) *pv;
! 	if (v == NULL || v->ob_type != &PyTuple_Type ||
 	 (v->ob_size != 0 && v->ob_refcnt != 1)) {
 		*pv = 0;

AltStyle によって変換されたページ (->オリジナル) /