[Python-checkins] CVS: python/dist/src/Objects abstract.c,2.76,2.77

Tim Peters tim_one@users.sourceforge.net
Mon, 10 Sep 2001 16:37:48 -0700


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

Modified Files:
	abstract.c 
Log Message:
More on SF bug [#460020] bug or feature: unicode() and subclasses.
tuple(i) repaired to return a true tuple when i is an instance of a
tuple subclass.
Added PyTuple_CheckExact macro.
PySequence_Tuple():  if a tuple-like object isn't exactly a tuple, it's
not safe to return the object as-is -- make a new tuple of it instead.


Index: abstract.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v
retrieving revision 2.76
retrieving revision 2.77
diff -C2 -d -r2.76 -r2.77
*** abstract.c	2001/09/10 21:28:20	2.76
--- abstract.c	2001/09/10 23:37:46	2.77
***************
*** 1236,1240 ****
  
  	/* Special-case the common tuple and list cases, for efficiency. */
! 	if (PyTuple_Check(v)) {
  		Py_INCREF(v);
  		return v;
--- 1236,1244 ----
  
  	/* Special-case the common tuple and list cases, for efficiency. */
! 	if (PyTuple_CheckExact(v)) {
! 		/* Note that we can't know whether it's safe to return
! 		   a tuple *subclass* instance as-is, hence the restriction
! 		   to exact tuples here.  In contrasts, lists always make
! 		   a copy, so there's need for exactness below. */
  		Py_INCREF(v);
  		return v;