[Python-Dev] RE: test_sort.py failure

Tim Peters tim.peters at gmail.com
Thu Jul 29 08:21:59 CEST 2004


[Nick Coghlan]
> If a shorter list would provoke this more consistently, would there be a
> benefit in having test_sort run this test twice? (Once with length 50,
> once with length 3)

Since I can't provoke it at all, someone who can will have to judge that one.

The test case as-is provoked segfaults in an earlier Python release,
and in more than one way, and needed a relatively large list to do so.
 It wasn't stellar at provoking this new bug, but at least three
people did see it fail.  That's good enough for me.  (And I have to
wonder how many others saw it fail but didn't think to report it until
Guido showed them it was possible <wink>.)

If someone wants to write a test to provoke the specifc bug that was
fixed, start with a list containing 3 elements.  Give the objects a
__lt__ that appends an element the first time it's called, pops that
element the second time it's called, asserts that it's not called a
3rd time, and returns True.  Whether that fails (by failing to raise
ValueError) still depends on the platform realloc(), but maximizes the
chance that the system realloc() will reuse the same memory blob
throughout.

And with that, I retire from this thread unless another bug pops up.


More information about the Python-Dev mailing list