Typo in message below: it was meant that negative indicies like vim.current.buffer[-1] were just failing.
# HG changeset patch # User ZyX <[email protected]> # Date 1367068412 -14400 # Branch python-extended-2 # Node ID 4f212c33aaa23e233b6ef7e267e49deda636a4a8 # Parent 33094bb2285ee31aeb62197d3df680e9620fb7ac Fix subscripts in python3 Previously it vim.current.buffer[-3] failed and slice assignment using negative subscripts was shifted by one diff -r 33094bb2285e -r 4f212c33aaa2 src/if_py_both.h --- a/src/if_py_both.h Sat Apr 27 14:00:10 2013 +0400 +++ b/src/if_py_both.h Sat Apr 27 17:13:32 2013 +0400 @@ -2394,6 +2394,9 @@ if (end == -1) end = self->buf->b_ml.ml_line_count; + if (n < 0) + n += end - start + 1; + if (n < 0 || n > end - start) { PyErr_SetString(PyExc_IndexError, _("line number out of range")); @@ -2441,6 +2444,9 @@ if (end == -1) end = self->buf->b_ml.ml_line_count; + if (n < 0) + n += end - start + 1; + if (n < 0 || n > end - start) { PyErr_SetString(PyExc_IndexError, _("line number out of range")); diff -r 33094bb2285e -r 4f212c33aaa2 src/if_python3.c --- a/src/if_python3.c Sat Apr 27 14:00:10 2013 +0400 +++ b/src/if_python3.c Sat Apr 27 17:13:32 2013 +0400 @@ -1114,7 +1114,7 @@ return NULL; if (PySlice_GetIndicesEx((PyObject *)idx, - (Py_ssize_t)((BufferObject *)(self))->buf->b_ml.ml_line_count+1, + (Py_ssize_t)((BufferObject *)(self))->buf->b_ml.ml_line_count, &start, &stop, &step, &slicelen) < 0) { @@ -1146,7 +1146,7 @@ return -1; if (PySlice_GetIndicesEx((PyObject *)idx, - (Py_ssize_t)((BufferObject *)(self))->buf->b_ml.ml_line_count+1, + (Py_ssize_t)((BufferObject *)(self))->buf->b_ml.ml_line_count, &start, &stop, &step, &slicelen) < 0) { -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
