]> granicus.if.org Git - python/commit
Fix obscure breakage (relative to 2.3) in listsort: the test for list
authorTim Peters <tim.peters@gmail.com>
Thu, 29 Jul 2004 04:07:15 +0000 (04:07 +0000)
committerTim Peters <tim.peters@gmail.com>
Thu, 29 Jul 2004 04:07:15 +0000 (04:07 +0000)
commit51b4ade30615dccaa7f591456528821f4320d5ff
tree523a2ab5f3c3154c3e175b6adec26eefdf23cfae
parent014f103705afef0c1c6d7dc740e6a4f21b2da794
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.
Include/listobject.h
Objects/listobject.c