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

Tim Peters tim_one@users.sourceforge.net
Tue, 11 Sep 2001 12:48:05 -0700


Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv901/python/Objects

Modified Files:
	tupleobject.c 
Log Message:
The endless 460020 bug.
Disable t[:], t*0, t*1 optimizations when t is of a tuple subclass type.


Index: tupleobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v
retrieving revision 2.59
retrieving revision 2.60
diff -C2 -d -r2.59 -r2.60
*** tupleobject.c	2001/09/02 06:42:25	2.59
--- tupleobject.c	2001/09/11 19:48:03	2.60
***************
*** 299,304 ****
  	if (ihigh < ilow)
  		ihigh = ilow;
! 	if (ilow == 0 && ihigh == a->ob_size) {
! 		/* XXX can only do this if tuples are immutable! */
  		Py_INCREF(a);
  		return (PyObject *)a;
--- 299,303 ----
  	if (ihigh < ilow)
  		ihigh = ilow;
! 	if (ilow == 0 && ihigh == a->ob_size && PyTuple_CheckExact(a)) {
  		Py_INCREF(a);
  		return (PyObject *)a;
***************
*** 367,374 ****
  		n = 0;
  	if (a->ob_size == 0 || n == 1) {
! 		/* Since tuples are immutable, we can return a shared
! 		   copy in this case */
! 		Py_INCREF(a);
! 		return (PyObject *)a;
  	}
  	size = a->ob_size * n;
--- 366,377 ----
  		n = 0;
  	if (a->ob_size == 0 || n == 1) {
! 		if (PyTuple_CheckExact(a)) {
! 			/* Since tuples are immutable, we can return a shared
! 			   copy in this case */
! 			Py_INCREF(a);
! 			return (PyObject *)a;
! 		}
! 		if (a->ob_size == 0)
! 			return PyTuple_New(0);
  	}
  	size = a->ob_size * n;