• Kevin Modzelewski's avatar
    Avoid creating most slice objects · 230439c5
    Kevin Modzelewski authored
    We've been allocating slice objects for slicing operations, but
    CPython's internal slice methods already take separate start+stop
    arguments.  So if we see a slice, instead of creating the slice
    and sending it off to getitem, try calling PySequence_GetSlice.
    
    This will be slower for classes with user-defined __getitem__
    functions that can handle slices; we can fix that by adding rewriting
    to this new endpoint, but it seems to not matter too much right now.
    230439c5
objmodel.h 11.3 KB