[Python-checkins] python/dist/src/Include listobject.h,2.29,2.30

tim_one at users.sourceforge.net tim_one at users.sourceforge.net
Thu Jul 29 06:07:22 CEST 2004


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

Modified Files:
	listobject.h 
Log Message:
Fix obscure breakage (relative to 2.3) in listsort:  the test for list
mutation during list.sort() used to rely on that listobject.c always
NULL'ed ob_item when ob_size fell to 0.  That's no longer true, so the
test for list mutation during a sort is no longer reliable.  Changed the
test to rely instead on that listobject.c now never NULLs-out ob_item
after (if ever) ob_item gets a non-NULL value.  This new assumption is
also documented now, as a required invariant in listobject.h.

The new assumption allowed some real simplification to some of the
hairier code in listsort(), so is a Good Thing on that count.


Index: listobject.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/listobject.h,v
retrieving revision 2.29
retrieving revision 2.30
diff -C2 -d -r2.29 -r2.30
*** listobject.h	29 Jul 2004 03:29:15 -0000	2.29
--- listobject.h	29 Jul 2004 04:07:14 -0000	2.30
***************
*** 31,34 ****
--- 31,37 ----
       *     len(list) == ob_size
       *     ob_item == NULL implies ob_size == allocated == 0
+      *     If ob_item ever becomes non-NULL, it remains non-NULL for the
+      *         life of the list object.  The check for mutation in list.sort()
+      *         relies on this odd detail.
       */
      int allocated;



More information about the Python-checkins mailing list