[Python-Dev] RE: test_sort.py failure
tim.one at comcast.net
Thu Jul 29 00:36:38 CEST 2004
[Guido van Rossum]
> I had test_sort.py fail once on line 143 (in test_bug453523).
How did it fail? By not raising any exception, or by raising an exception
other than ValueError?
> Later it wouldn't fail. The code in question uses a random generator.
> Could I have been unlucky enough that the particular random sequence it
> used this time didn't create the intended failure condition?
No: every call to __lt__ mutates the list, the code checking for list
mutation should be impossible to fool, the code checking for list mutation
raises ValueError at the end of list.sort() iff mutation occurred during the
sort, and since the list has more than 1 element __lt__ will be called at
least once. It's possible that the code checking for list mutation became
less than bulletproof after list object internals were reworked, though --
don't know about that. While it was bulletproof before (according to both
Armin and me), it was delicate (as evidence, it took both Armin and me to
come up with it <wink>).
More information about the Python-Dev