[Python-Dev] RE: test_sort.py failure
arigo at tunes.org
Fri Jul 30 05:02:49 CEST 2004
On Thu, Jul 29, 2004 at 06:06:19AM -0400, Raymond Hettinger wrote:
> > > * list_ass_slice() should add a line to maintain them,
> > > * list_resize() can drop the test for ob_item != NULL, and
> Will put these in.
I think the list_ass_slice() modification you are thinking about is obsolete
since the check-in I documented in my latest e-mail.
list_resize() dropping the test for ob_item != NULL looks like a sane plan:
the only C extensions that I can think of that could break would be the ones
that for extreme performance hacking don't use PyList_SetSlice() to clear a
list, but directly zero out ob_size and ob_item -- which is a real bad thing
About clearing lists efficiently: what about adding PyList_Clear() to the
public API? It's clearer than the current
PyList_SetSlice(lst, 0, PyList_GET_SIZE(lst), (PyObject *)NULL)
(which BTW could fail with a MemoryError up to yesterday; I bet not all users
of this idiom were aware of that. There was even an example of not checking
the return value in listobject.c itself!) By contrast, PyList_Clear(), like
list_clear(), would never fail and could return void.
More information about the Python-Dev