[Python-checkins] python/dist/src/Objects listobject.c,2.172,2.173

jhylton at users.sourceforge.net jhylton at users.sourceforge.net
Fri Dec 26 14:05:07 EST 2003


Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1:/tmp/cvs-serv32521
Modified Files:
	listobject.c 
Log Message:
Revert previous two checkins to repair test failure.
The special-case code that was removed could return a value indicating
success but leave an exception set. test_fileinput failed in a debug
build as a result.
Index: listobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v
retrieving revision 2.172
retrieving revision 2.173
diff -C2 -d -r2.172 -r2.173
*** listobject.c	26 Dec 2003 00:09:04 -0000	2.172
--- listobject.c	26 Dec 2003 19:05:04 -0000	2.173
***************
*** 2235,2245 ****
 }
 
- /* empirically determined threshold for activating an optimisation
- * in list_fill() - 100 seems close to optimum for current CPUs and
- * compilers, as of December '03.
- * see also comment in list_fill().
- */
- #define	LISTFILL_OPT_THRESHOLD	100
- 
 /* Adapted from newer code by Tim */
 static int
--- 2235,2238 ----
***************
*** 2256,2276 ****
 	n = result->ob_size;
 
! 	/* Special-case list(a_list), for speed:
! 	 * - if the source has 0 elements, there's nothing to copy.
! 	 * - if the source has more than a threshold number of elements
! 	 * slice assignment is a faster way of filling the target
! 	 * (the exact threshold is subject to empirical determination).
! 	 * Also special case any other zero length sequence, including
! 	 * subclasses of list, there being nothing to copy.
! 	 */
! 	if (PyList_CheckExact(v)) {
! 		i = PyList_GET_SIZE(v);
! 		if (i == 0)
! 			return 0;
! 		if (i > LISTFILL_OPT_THRESHOLD)
! 			return list_ass_slice(result, 0, n, v);
! 	} else
! 		if (PySequence_Check(v) && PySequence_Size(v) == 0)
! 			return 0;
 
 	/* Empty previous contents */
--- 2249,2258 ----
 	n = result->ob_size;
 
! 	/* Special-case list(a_list), for speed. */
! 	if (PyList_Check(v)) {
! 		if (v == (PyObject *)result)
! 			return 0; /* source is destination, we're done */
! 		return list_ass_slice(result, 0, n, v);
! 	}
 
 	/* Empty previous contents */


More information about the Python-checkins mailing list

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