2011/12/12 Victor Stinner <victor.stin...@haypocalc.com>

> "When sorting a list using the sort() method, attempting to inspect or
> mutate the content of the list will result in undefined behaviour."


But is this even true? in listobject.c::listsort(), since 2002,
/* The list is temporarily made empty, so that mutations performed
 * by comparison functions can't affect the slice of memory we're
 * sorting (allowing mutations during sorting is a core-dump
 * factory, since ob_item may change).
 */
So behaviour is not undefined at all... maybe this report is only based on
note #10 of the documentation:
http://docs.python.org/library/stdtypes.html#mutable-sequence-types
and only considers python 2.2 or older...

-- 
Amaury Forgeot d'Arc
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to