summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-04-05 19:32:36 +0200
committerBram Moolenaar <Bram@vim.org>2013-04-05 19:32:36 +0200
commit24b11fb1730e37a4aa71434c130301a9369c835f (patch)
tree0b8dc8fb4edf02132027a7b2957e523ec226c71c /src
parentb3049f4a34af835f558877c9f4c323e50269c00f (diff)
downloadvim-24b11fb1730e37a4aa71434c130301a9369c835f.zip
updated for version 7.3.881
Problem: Python list does not work correctly. Solution: Fix it and add a test. (Yukihiro Nakadaira)
Diffstat (limited to 'src')
-rw-r--r--src/if_py_both.h2
-rw-r--r--src/testdir/test86.in25
-rw-r--r--src/testdir/test86.ok11
-rw-r--r--src/version.c2
4 files changed, 39 insertions, 1 deletions
diff --git a/src/if_py_both.h b/src/if_py_both.h
index 1d999095e..f5617acfc 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -1139,7 +1139,7 @@ ListSlice(PyObject *self, Py_ssize_t first, Py_ssize_t last)
for (i = 0; i < n; ++i)
{
- PyObject *item = ListItem(self, i);
+ PyObject *item = ListItem(self, first + i);
if (item == NULL)
{
Py_DECREF(list);
diff --git a/src/testdir/test86.in b/src/testdir/test86.in
index 5282269a3..b53b6bf39 100644
--- a/src/testdir/test86.in
+++ b/src/testdir/test86.in
@@ -321,6 +321,31 @@ EOF
:py trace_main()
:py sys.settrace(None)
:$put =string(l)
+:"
+:" Slice
+:py ll = vim.bindeval('[0, 1, 2, 3, 4, 5]')
+:py l = ll[:4]
+:$put =string(pyeval('l'))
+:py l = ll[2:]
+:$put =string(pyeval('l'))
+:py l = ll[:-4]
+:$put =string(pyeval('l'))
+:py l = ll[-2:]
+:$put =string(pyeval('l'))
+:py l = ll[2:4]
+:$put =string(pyeval('l'))
+:py l = ll[4:2]
+:$put =string(pyeval('l'))
+:py l = ll[-4:-2]
+:$put =string(pyeval('l'))
+:py l = ll[-2:-4]
+:$put =string(pyeval('l'))
+:py l = ll[:]
+:$put =string(pyeval('l'))
+:py l = ll[0:6]
+:$put =string(pyeval('l'))
+:py l = ll[-10:10]
+:$put =string(pyeval('l'))
:endfun
:"
:call Test()
diff --git a/src/testdir/test86.ok b/src/testdir/test86.ok
index 8960390f5..fd670c846 100644
--- a/src/testdir/test86.ok
+++ b/src/testdir/test86.ok
@@ -65,3 +65,14 @@ undefined_name: Vim(let):Trace
vim: Vim(let):E859:
[1]
[1, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 1]
+[0, 1, 2, 3]
+[2, 3, 4, 5]
+[0, 1]
+[4, 5]
+[2, 3]
+[]
+[2, 3]
+[]
+[0, 1, 2, 3, 4, 5]
+[0, 1, 2, 3, 4, 5]
+[0, 1, 2, 3, 4, 5]
diff --git a/src/version.c b/src/version.c
index 78dc1d002..4d056c640 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 881,
+/**/
880,
/**/
879,