• Armin Rigo's avatar
    This is a reorganization of list_ass_slice(). It should probably be reviewed, · 1dd04a02
    Armin Rigo authored
    though I tried to be very careful.  This is a slight simplification, and it
    adds a new feature: a small stack-allocated "recycled" array for the cases
    when we don't remove too many items.
    
    It allows PyList_SetSlice() to never fail if:
    * you are sure that the object is a list; and
    * you either do not remove more than 8 items, or clear the list.
    
    This makes a number of other places in the source code correct again -- there
    are some places that delete a single item without checking for MemoryErrors
    raised by PyList_SetSlice(), or that clear the whole list, and sometimes the
    context doesn't allow an error to be propagated.
    1dd04a02
listobject.c 66.4 KB