This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paulhankin
Recipients
Date 2007-03-11.16:25:04
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
An alternative to the tail memmove would just be to incorporate it in the main loop; something like (untested):

for(i=0; i<slicelength; i++){
    size_t target = start + i * (step - 1);
    size_t source = start + i * step + 1;
    size_t source_end = i < slicelength - 1 ? source + step - 1
                                            : self->ob_size;
    garbage[i] = PyList_GET_ITEM(self, start + i * step);
    assert(source_end <= self->ob_size);
    memmove(&self->ob_item[target], &self->ob_item[source],
        (source_end - source) * sizeof(PyObject *));
}

I think this also makes it more obvious what's going on - at the moment the code smells a bit funny, even with your new comment.

Otherwise, the change looks good.
History
Date User Action Args
2007-08-23 15:55:49adminlinkissue1617687 messages
2007-08-23 15:55:49admincreate