Hello, On Wed, Jul 28, 2004 at 05:00:59PM -0700, Guido van Rossum wrote: > Mucking with the list causes realloc() calls to the memory block > initially pointed to by empty_ob_item. This is likely to move the > block. But it *could* be that there's enough space following the > block that it *doesn't* have to be moved, and if the array also > happens to be empty after the sort (there's a certain probability that > this is so), the test will pass despite the mucking. I think Tim is right: the code used to be correct, but the list internals reorganization might have broken that. As far as I remember, the reason it used to be fine is that lists with zero elements were always deallocated, so that empty lists never had an allocated ob_items array. If user code populated and then emptied again the list during the sort, it couldn't end up again in the special state list_sort() puts it in, which is ob_size == 0 but ob_items allocated. Apparently, this can occur now. Looks like another review of list_sort() is needed. (Some time ago, after staring at it for some time, I wondered and couldn't figure out if there was a memory leak or not, too) Armin
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4