|
Karsten Hopp |
143428 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
143428 |
Subject: Patch 7.4.151
|
|
Karsten Hopp |
143428 |
Fcc: outbox
|
|
Karsten Hopp |
143428 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
143428 |
Mime-Version: 1.0
|
|
Karsten Hopp |
143428 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
143428 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
143428 |
------------
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
Patch 7.4.151
|
|
Karsten Hopp |
143428 |
Problem: Python: slices with steps are not supported.
|
|
Karsten Hopp |
143428 |
Solution: Support slices in Python vim.List. (ZyX)
|
|
Karsten Hopp |
143428 |
Files: src/eval.c, src/if_py_both.h, src/if_python3.c, src/if_python.c,
|
|
Karsten Hopp |
143428 |
src/proto/eval.pro, src/testdir/test86.in, src/testdir/test86.ok,
|
|
Karsten Hopp |
143428 |
src/testdir/test87.in, src/testdir/test87.ok
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
*** ../vim-7.4.150/src/eval.c 2014-01-14 15:24:24.000000000 +0100
|
|
Karsten Hopp |
143428 |
--- src/eval.c 2014-01-14 16:24:49.000000000 +0100
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 6425,6430 ****
|
|
Karsten Hopp |
143428 |
--- 6425,6440 ----
|
|
Karsten Hopp |
143428 |
if (ni == NULL)
|
|
Karsten Hopp |
143428 |
return FAIL;
|
|
Karsten Hopp |
143428 |
copy_tv(tv, &ni->li_tv);
|
|
Karsten Hopp |
143428 |
+ list_insert(l, ni, item);
|
|
Karsten Hopp |
143428 |
+ return OK;
|
|
Karsten Hopp |
143428 |
+ }
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
+ void
|
|
Karsten Hopp |
143428 |
+ list_insert(l, ni, item)
|
|
Karsten Hopp |
143428 |
+ list_T *l;
|
|
Karsten Hopp |
143428 |
+ listitem_T *ni;
|
|
Karsten Hopp |
143428 |
+ listitem_T *item;
|
|
Karsten Hopp |
143428 |
+ {
|
|
Karsten Hopp |
143428 |
if (item == NULL)
|
|
Karsten Hopp |
143428 |
/* Append new item at end of list. */
|
|
Karsten Hopp |
143428 |
list_append(l, ni);
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 6446,6452 ****
|
|
Karsten Hopp |
143428 |
item->li_prev = ni;
|
|
Karsten Hopp |
143428 |
++l->lv_len;
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
- return OK;
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
/*
|
|
Karsten Hopp |
143428 |
--- 6456,6461 ----
|
|
Karsten Hopp |
143428 |
*** ../vim-7.4.150/src/if_py_both.h 2014-01-10 18:16:00.000000000 +0100
|
|
Karsten Hopp |
143428 |
--- src/if_py_both.h 2014-01-14 16:31:49.000000000 +0100
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 36,43 ****
|
|
Karsten Hopp |
143428 |
#define PyErr_SET_STRING(exc, str) PyErr_SetString(exc, _(str))
|
|
Karsten Hopp |
143428 |
#define PyErr_SetVim(str) PyErr_SetString(VimError, str)
|
|
Karsten Hopp |
143428 |
#define PyErr_SET_VIM(str) PyErr_SET_STRING(VimError, str)
|
|
Karsten Hopp |
143428 |
! #define PyErr_FORMAT(exc, str, tail) PyErr_Format(exc, _(str), tail)
|
|
Karsten Hopp |
143428 |
! #define PyErr_VIM_FORMAT(str, tail) PyErr_FORMAT(VimError, str, tail)
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
#define Py_TYPE_NAME(obj) (obj->ob_type->tp_name == NULL \
|
|
Karsten Hopp |
143428 |
? "(NULL)" \
|
|
Karsten Hopp |
143428 |
--- 36,44 ----
|
|
Karsten Hopp |
143428 |
#define PyErr_SET_STRING(exc, str) PyErr_SetString(exc, _(str))
|
|
Karsten Hopp |
143428 |
#define PyErr_SetVim(str) PyErr_SetString(VimError, str)
|
|
Karsten Hopp |
143428 |
#define PyErr_SET_VIM(str) PyErr_SET_STRING(VimError, str)
|
|
Karsten Hopp |
143428 |
! #define PyErr_FORMAT(exc, str, arg) PyErr_Format(exc, _(str), arg)
|
|
Karsten Hopp |
143428 |
! #define PyErr_FORMAT2(exc, str, arg1, arg2) PyErr_Format(exc, _(str), arg1,arg2)
|
|
Karsten Hopp |
143428 |
! #define PyErr_VIM_FORMAT(str, arg) PyErr_FORMAT(VimError, str, arg)
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
#define Py_TYPE_NAME(obj) (obj->ob_type->tp_name == NULL \
|
|
Karsten Hopp |
143428 |
? "(NULL)" \
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 2108,2115 ****
|
|
Karsten Hopp |
143428 |
};
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
static PyTypeObject ListType;
|
|
Karsten Hopp |
143428 |
- static PySequenceMethods ListAsSeq;
|
|
Karsten Hopp |
143428 |
- static PyMappingMethods ListAsMapping;
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
typedef struct
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
--- 2109,2114 ----
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 2253,2259 ****
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
static PyObject *
|
|
Karsten Hopp |
143428 |
! ListItem(ListObject *self, Py_ssize_t index)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
listitem_T *li;
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
--- 2252,2258 ----
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
static PyObject *
|
|
Karsten Hopp |
143428 |
! ListIndex(ListObject *self, Py_ssize_t index)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
listitem_T *li;
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 2273,2436 ****
|
|
Karsten Hopp |
143428 |
return ConvertToPyObject(&li->li_tv);
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
- #define PROC_RANGE \
|
|
Karsten Hopp |
143428 |
- if (last < 0) {\
|
|
Karsten Hopp |
143428 |
- if (last < -size) \
|
|
Karsten Hopp |
143428 |
- last = 0; \
|
|
Karsten Hopp |
143428 |
- else \
|
|
Karsten Hopp |
143428 |
- last += size; \
|
|
Karsten Hopp |
143428 |
- } \
|
|
Karsten Hopp |
143428 |
- if (first < 0) \
|
|
Karsten Hopp |
143428 |
- first = 0; \
|
|
Karsten Hopp |
143428 |
- if (first > size) \
|
|
Karsten Hopp |
143428 |
- first = size; \
|
|
Karsten Hopp |
143428 |
- if (last > size) \
|
|
Karsten Hopp |
143428 |
- last = size;
|
|
Karsten Hopp |
143428 |
-
|
|
Karsten Hopp |
143428 |
static PyObject *
|
|
Karsten Hopp |
143428 |
! ListSlice(ListObject *self, Py_ssize_t first, Py_ssize_t last)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
PyInt i;
|
|
Karsten Hopp |
143428 |
- PyInt size = ListLength(self);
|
|
Karsten Hopp |
143428 |
- PyInt n;
|
|
Karsten Hopp |
143428 |
PyObject *list;
|
|
Karsten Hopp |
143428 |
- int reversed = 0;
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
! PROC_RANGE
|
|
Karsten Hopp |
143428 |
! if (first >= last)
|
|
Karsten Hopp |
143428 |
! first = last;
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
! n = last-first;
|
|
Karsten Hopp |
143428 |
! list = PyList_New(n);
|
|
Karsten Hopp |
143428 |
if (list == NULL)
|
|
Karsten Hopp |
143428 |
return NULL;
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
! for (i = 0; i < n; ++i)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
! PyObject *item = ListItem(self, first + i);
|
|
Karsten Hopp |
143428 |
if (item == NULL)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
Py_DECREF(list);
|
|
Karsten Hopp |
143428 |
return NULL;
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
! PyList_SET_ITEM(list, ((reversed)?(n-i-1):(i)), item);
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
return list;
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
- typedef struct
|
|
Karsten Hopp |
143428 |
- {
|
|
Karsten Hopp |
143428 |
- listwatch_T lw;
|
|
Karsten Hopp |
143428 |
- list_T *list;
|
|
Karsten Hopp |
143428 |
- } listiterinfo_T;
|
|
Karsten Hopp |
143428 |
-
|
|
Karsten Hopp |
143428 |
- static void
|
|
Karsten Hopp |
143428 |
- ListIterDestruct(listiterinfo_T *lii)
|
|
Karsten Hopp |
143428 |
- {
|
|
Karsten Hopp |
143428 |
- list_rem_watch(lii->list, &lii->lw);
|
|
Karsten Hopp |
143428 |
- PyMem_Free(lii);
|
|
Karsten Hopp |
143428 |
- }
|
|
Karsten Hopp |
143428 |
-
|
|
Karsten Hopp |
143428 |
static PyObject *
|
|
Karsten Hopp |
143428 |
! ListIterNext(listiterinfo_T **lii)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
! PyObject *ret;
|
|
Karsten Hopp |
143428 |
!
|
|
Karsten Hopp |
143428 |
! if (!((*lii)->lw.lw_item))
|
|
Karsten Hopp |
143428 |
! return NULL;
|
|
Karsten Hopp |
143428 |
!
|
|
Karsten Hopp |
143428 |
! if (!(ret = ConvertToPyObject(&((*lii)->lw.lw_item->li_tv))))
|
|
Karsten Hopp |
143428 |
! return NULL;
|
|
Karsten Hopp |
143428 |
!
|
|
Karsten Hopp |
143428 |
! (*lii)->lw.lw_item = (*lii)->lw.lw_item->li_next;
|
|
Karsten Hopp |
143428 |
!
|
|
Karsten Hopp |
143428 |
! return ret;
|
|
Karsten Hopp |
143428 |
! }
|
|
Karsten Hopp |
143428 |
!
|
|
Karsten Hopp |
143428 |
! static PyObject *
|
|
Karsten Hopp |
143428 |
! ListIter(ListObject *self)
|
|
Karsten Hopp |
143428 |
! {
|
|
Karsten Hopp |
143428 |
! listiterinfo_T *lii;
|
|
Karsten Hopp |
143428 |
! list_T *l = self->list;
|
|
Karsten Hopp |
143428 |
!
|
|
Karsten Hopp |
143428 |
! if (!(lii = PyMem_New(listiterinfo_T, 1)))
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
! PyErr_NoMemory();
|
|
Karsten Hopp |
143428 |
! return NULL;
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
!
|
|
Karsten Hopp |
143428 |
! list_add_watch(l, &lii->lw);
|
|
Karsten Hopp |
143428 |
! lii->lw.lw_item = l->lv_first;
|
|
Karsten Hopp |
143428 |
! lii->list = l;
|
|
Karsten Hopp |
143428 |
!
|
|
Karsten Hopp |
143428 |
! return IterNew(lii,
|
|
Karsten Hopp |
143428 |
! (destructorfun) ListIterDestruct, (nextfun) ListIterNext,
|
|
Karsten Hopp |
143428 |
! NULL, NULL);
|
|
Karsten Hopp |
143428 |
! }
|
|
Karsten Hopp |
143428 |
!
|
|
Karsten Hopp |
143428 |
! static int
|
|
Karsten Hopp |
143428 |
! ListAssItem(ListObject *self, Py_ssize_t index, PyObject *obj)
|
|
Karsten Hopp |
143428 |
! {
|
|
Karsten Hopp |
143428 |
! typval_T tv;
|
|
Karsten Hopp |
143428 |
! list_T *l = self->list;
|
|
Karsten Hopp |
143428 |
! listitem_T *li;
|
|
Karsten Hopp |
143428 |
! Py_ssize_t length = ListLength(self);
|
|
Karsten Hopp |
143428 |
!
|
|
Karsten Hopp |
143428 |
! if (l->lv_lock)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
! RAISE_LOCKED_LIST;
|
|
Karsten Hopp |
143428 |
! return -1;
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
! if (index > length || (index == length && obj == NULL))
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
! PyErr_SET_STRING(PyExc_IndexError, N_("list index out of range"));
|
|
Karsten Hopp |
143428 |
! return -1;
|
|
Karsten Hopp |
143428 |
! }
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
! if (obj == NULL)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
! li = list_find(l, (long) index);
|
|
Karsten Hopp |
143428 |
! list_remove(l, li, li);
|
|
Karsten Hopp |
143428 |
! clear_tv(&li->li_tv);
|
|
Karsten Hopp |
143428 |
! vim_free(li);
|
|
Karsten Hopp |
143428 |
! return 0;
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
! if (ConvertFromPyObject(obj, &tv) == -1)
|
|
Karsten Hopp |
143428 |
! return -1;
|
|
Karsten Hopp |
143428 |
!
|
|
Karsten Hopp |
143428 |
! if (index == length)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
! if (list_append_tv(l, &tv) == FAIL)
|
|
Karsten Hopp |
143428 |
! {
|
|
Karsten Hopp |
143428 |
! clear_tv(&tv;;
|
|
Karsten Hopp |
143428 |
! PyErr_SET_VIM(N_("failed to add item to list"));
|
|
Karsten Hopp |
143428 |
! return -1;
|
|
Karsten Hopp |
143428 |
! }
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
! else
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
! li = list_find(l, (long) index);
|
|
Karsten Hopp |
143428 |
! clear_tv(&li->li_tv);
|
|
Karsten Hopp |
143428 |
! copy_tv(&tv, &li->li_tv);
|
|
Karsten Hopp |
143428 |
! clear_tv(&tv;;
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
- return 0;
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
static int
|
|
Karsten Hopp |
143428 |
! ListAssSlice(ListObject *self, Py_ssize_t first, Py_ssize_t last, PyObject *obj)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
- PyInt size = ListLength(self);
|
|
Karsten Hopp |
143428 |
PyObject *iterator;
|
|
Karsten Hopp |
143428 |
PyObject *item;
|
|
Karsten Hopp |
143428 |
listitem_T *li;
|
|
Karsten Hopp |
143428 |
listitem_T *next;
|
|
Karsten Hopp |
143428 |
typval_T v;
|
|
Karsten Hopp |
143428 |
list_T *l = self->list;
|
|
Karsten Hopp |
143428 |
PyInt i;
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
if (l->lv_lock)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
--- 2272,2381 ----
|
|
Karsten Hopp |
143428 |
return ConvertToPyObject(&li->li_tv);
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
static PyObject *
|
|
Karsten Hopp |
143428 |
! ListSlice(ListObject *self, Py_ssize_t first, Py_ssize_t step,
|
|
Karsten Hopp |
143428 |
! Py_ssize_t slicelen)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
PyInt i;
|
|
Karsten Hopp |
143428 |
PyObject *list;
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
! if (step == 0)
|
|
Karsten Hopp |
143428 |
! {
|
|
Karsten Hopp |
143428 |
! PyErr_SET_STRING(PyExc_ValueError, N_("slice step cannot be zero"));
|
|
Karsten Hopp |
143428 |
! return NULL;
|
|
Karsten Hopp |
143428 |
! }
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
! list = PyList_New(slicelen);
|
|
Karsten Hopp |
143428 |
if (list == NULL)
|
|
Karsten Hopp |
143428 |
return NULL;
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
! for (i = 0; i < slicelen; ++i)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
! PyObject *item;
|
|
Karsten Hopp |
143428 |
!
|
|
Karsten Hopp |
143428 |
! item = ListIndex(self, first + i*step);
|
|
Karsten Hopp |
143428 |
if (item == NULL)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
Py_DECREF(list);
|
|
Karsten Hopp |
143428 |
return NULL;
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
! PyList_SET_ITEM(list, i, item);
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
return list;
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
static PyObject *
|
|
Karsten Hopp |
143428 |
! ListItem(ListObject *self, PyObject* idx)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
! #if PY_MAJOR_VERSION < 3
|
|
Karsten Hopp |
143428 |
! if (PyInt_Check(idx))
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
! long _idx = PyInt_AsLong(idx);
|
|
Karsten Hopp |
143428 |
! return ListIndex(self, _idx);
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
! else
|
|
Karsten Hopp |
143428 |
! #endif
|
|
Karsten Hopp |
143428 |
! if (PyLong_Check(idx))
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
! long _idx = PyLong_AsLong(idx);
|
|
Karsten Hopp |
143428 |
! return ListIndex(self, _idx);
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
! else if (PySlice_Check(idx))
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
! Py_ssize_t start, stop, step, slicelen;
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
! if (PySlice_GetIndicesEx(idx, ListLength(self),
|
|
Karsten Hopp |
143428 |
! &start, &stop, &step, &slicelen) < 0)
|
|
Karsten Hopp |
143428 |
! return NULL;
|
|
Karsten Hopp |
143428 |
! return ListSlice(self, start, step, slicelen);
|
|
Karsten Hopp |
143428 |
! }
|
|
Karsten Hopp |
143428 |
! else
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
! RAISE_INVALID_INDEX_TYPE(idx);
|
|
Karsten Hopp |
143428 |
! return NULL;
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
+ }
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
! static void
|
|
Karsten Hopp |
143428 |
! list_restore(Py_ssize_t numadded, Py_ssize_t numreplaced, Py_ssize_t slicelen,
|
|
Karsten Hopp |
143428 |
! list_T *l, listitem_T **lis, listitem_T *lastaddedli)
|
|
Karsten Hopp |
143428 |
! {
|
|
Karsten Hopp |
143428 |
! while (numreplaced--)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
! list_insert(l, lis[numreplaced], lis[slicelen + numreplaced]);
|
|
Karsten Hopp |
143428 |
! listitem_remove(l, lis[slicelen + numreplaced]);
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
! while (numadded--)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
! listitem_T *next;
|
|
Karsten Hopp |
143428 |
!
|
|
Karsten Hopp |
143428 |
! next = lastaddedli->li_prev;
|
|
Karsten Hopp |
143428 |
! listitem_remove(l, lastaddedli);
|
|
Karsten Hopp |
143428 |
! lastaddedli = next;
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
static int
|
|
Karsten Hopp |
143428 |
! ListAssSlice(ListObject *self, Py_ssize_t first,
|
|
Karsten Hopp |
143428 |
! Py_ssize_t step, Py_ssize_t slicelen, PyObject *obj)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
PyObject *iterator;
|
|
Karsten Hopp |
143428 |
PyObject *item;
|
|
Karsten Hopp |
143428 |
listitem_T *li;
|
|
Karsten Hopp |
143428 |
+ listitem_T *lastaddedli = NULL;
|
|
Karsten Hopp |
143428 |
listitem_T *next;
|
|
Karsten Hopp |
143428 |
typval_T v;
|
|
Karsten Hopp |
143428 |
list_T *l = self->list;
|
|
Karsten Hopp |
143428 |
PyInt i;
|
|
Karsten Hopp |
143428 |
+ PyInt j;
|
|
Karsten Hopp |
143428 |
+ PyInt numreplaced = 0;
|
|
Karsten Hopp |
143428 |
+ PyInt numadded = 0;
|
|
Karsten Hopp |
143428 |
+ PyInt size;
|
|
Karsten Hopp |
143428 |
+ listitem_T **lis;
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
+ size = ListLength(self);
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
if (l->lv_lock)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 2438,2444 ****
|
|
Karsten Hopp |
143428 |
return -1;
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
! PROC_RANGE
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
if (first == size)
|
|
Karsten Hopp |
143428 |
li = NULL;
|
|
Karsten Hopp |
143428 |
--- 2383,2424 ----
|
|
Karsten Hopp |
143428 |
return -1;
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
! if (step == 0)
|
|
Karsten Hopp |
143428 |
! {
|
|
Karsten Hopp |
143428 |
! PyErr_SET_STRING(PyExc_ValueError, N_("slice step cannot be zero"));
|
|
Karsten Hopp |
143428 |
! return -1;
|
|
Karsten Hopp |
143428 |
! }
|
|
Karsten Hopp |
143428 |
!
|
|
Karsten Hopp |
143428 |
! if (step != 1 && slicelen == 0)
|
|
Karsten Hopp |
143428 |
! {
|
|
Karsten Hopp |
143428 |
! /* Nothing to do. Only error out if obj has some items. */
|
|
Karsten Hopp |
143428 |
! int ret = 0;
|
|
Karsten Hopp |
143428 |
!
|
|
Karsten Hopp |
143428 |
! if (obj == NULL)
|
|
Karsten Hopp |
143428 |
! return 0;
|
|
Karsten Hopp |
143428 |
!
|
|
Karsten Hopp |
143428 |
! if (!(iterator = PyObject_GetIter(obj)))
|
|
Karsten Hopp |
143428 |
! return -1;
|
|
Karsten Hopp |
143428 |
!
|
|
Karsten Hopp |
143428 |
! if ((item = PyIter_Next(iterator)))
|
|
Karsten Hopp |
143428 |
! {
|
|
Karsten Hopp |
143428 |
! PyErr_FORMAT(PyExc_ValueError,
|
|
Karsten Hopp |
143428 |
! N_("attempt to assign sequence of size greater then %d "
|
|
Karsten Hopp |
143428 |
! "to extended slice"), 0);
|
|
Karsten Hopp |
143428 |
! Py_DECREF(item);
|
|
Karsten Hopp |
143428 |
! ret = -1;
|
|
Karsten Hopp |
143428 |
! }
|
|
Karsten Hopp |
143428 |
! Py_DECREF(iterator);
|
|
Karsten Hopp |
143428 |
! return ret;
|
|
Karsten Hopp |
143428 |
! }
|
|
Karsten Hopp |
143428 |
!
|
|
Karsten Hopp |
143428 |
! if (obj != NULL)
|
|
Karsten Hopp |
143428 |
! /* XXX May allocate zero bytes. */
|
|
Karsten Hopp |
143428 |
! if (!(lis = PyMem_New(listitem_T *, slicelen * 2)))
|
|
Karsten Hopp |
143428 |
! {
|
|
Karsten Hopp |
143428 |
! PyErr_NoMemory();
|
|
Karsten Hopp |
143428 |
! return -1;
|
|
Karsten Hopp |
143428 |
! }
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
if (first == size)
|
|
Karsten Hopp |
143428 |
li = NULL;
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 2449,2465 ****
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
PyErr_VIM_FORMAT(N_("internal error: no vim list item %d"),
|
|
Karsten Hopp |
143428 |
(int)first);
|
|
Karsten Hopp |
143428 |
return -1;
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
! if (last > first)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
! i = last - first;
|
|
Karsten Hopp |
143428 |
! while (i-- && li != NULL)
|
|
Karsten Hopp |
143428 |
! {
|
|
Karsten Hopp |
143428 |
! next = li->li_next;
|
|
Karsten Hopp |
143428 |
listitem_remove(l, li);
|
|
Karsten Hopp |
143428 |
! li = next;
|
|
Karsten Hopp |
143428 |
! }
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
--- 2429,2461 ----
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
PyErr_VIM_FORMAT(N_("internal error: no vim list item %d"),
|
|
Karsten Hopp |
143428 |
(int)first);
|
|
Karsten Hopp |
143428 |
+ if (obj != NULL)
|
|
Karsten Hopp |
143428 |
+ PyMem_Free(lis);
|
|
Karsten Hopp |
143428 |
return -1;
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
! i = slicelen;
|
|
Karsten Hopp |
143428 |
! while (i-- && li != NULL)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
! j = step;
|
|
Karsten Hopp |
143428 |
! next = li;
|
|
Karsten Hopp |
143428 |
! if (step > 0)
|
|
Karsten Hopp |
143428 |
! while (next != NULL && ((next = next->li_next) != NULL) && --j);
|
|
Karsten Hopp |
143428 |
! else
|
|
Karsten Hopp |
143428 |
! while (next != NULL && ((next = next->li_prev) != NULL) && ++j);
|
|
Karsten Hopp |
143428 |
!
|
|
Karsten Hopp |
143428 |
! if (obj == NULL)
|
|
Karsten Hopp |
143428 |
listitem_remove(l, li);
|
|
Karsten Hopp |
143428 |
! else
|
|
Karsten Hopp |
143428 |
! lis[slicelen - i - 1] = li;
|
|
Karsten Hopp |
143428 |
!
|
|
Karsten Hopp |
143428 |
! li = next;
|
|
Karsten Hopp |
143428 |
! }
|
|
Karsten Hopp |
143428 |
! if (li == NULL && i != -1)
|
|
Karsten Hopp |
143428 |
! {
|
|
Karsten Hopp |
143428 |
! PyErr_SET_VIM(N_("internal error: not enough list items"));
|
|
Karsten Hopp |
143428 |
! if (obj != NULL)
|
|
Karsten Hopp |
143428 |
! PyMem_Free(lis);
|
|
Karsten Hopp |
143428 |
! return -1;
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 2467,2499 ****
|
|
Karsten Hopp |
143428 |
return 0;
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
if (!(iterator = PyObject_GetIter(obj)))
|
|
Karsten Hopp |
143428 |
return -1;
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
while ((item = PyIter_Next(iterator)))
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
if (ConvertFromPyObject(item, &v) == -1)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
Py_DECREF(iterator);
|
|
Karsten Hopp |
143428 |
Py_DECREF(item);
|
|
Karsten Hopp |
143428 |
return -1;
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
Py_DECREF(item);
|
|
Karsten Hopp |
143428 |
! if (list_insert_tv(l, &v, li) == FAIL)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
clear_tv(&v);
|
|
Karsten Hopp |
143428 |
PyErr_SET_VIM(N_("internal error: failed to add item to list"));
|
|
Karsten Hopp |
143428 |
return -1;
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
clear_tv(&v);
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
Py_DECREF(iterator);
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
if (PyErr_Occurred())
|
|
Karsten Hopp |
143428 |
return -1;
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
return 0;
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
static PyObject *
|
|
Karsten Hopp |
143428 |
ListConcatInPlace(ListObject *self, PyObject *obj)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
--- 2463,2634 ----
|
|
Karsten Hopp |
143428 |
return 0;
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
if (!(iterator = PyObject_GetIter(obj)))
|
|
Karsten Hopp |
143428 |
+ {
|
|
Karsten Hopp |
143428 |
+ PyMem_Free(lis);
|
|
Karsten Hopp |
143428 |
return -1;
|
|
Karsten Hopp |
143428 |
+ }
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
+ i = 0;
|
|
Karsten Hopp |
143428 |
while ((item = PyIter_Next(iterator)))
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
if (ConvertFromPyObject(item, &v) == -1)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
Py_DECREF(iterator);
|
|
Karsten Hopp |
143428 |
Py_DECREF(item);
|
|
Karsten Hopp |
143428 |
+ PyMem_Free(lis);
|
|
Karsten Hopp |
143428 |
return -1;
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
Py_DECREF(item);
|
|
Karsten Hopp |
143428 |
! if (list_insert_tv(l, &v, numreplaced < slicelen
|
|
Karsten Hopp |
143428 |
! ? lis[numreplaced]
|
|
Karsten Hopp |
143428 |
! : li) == FAIL)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
clear_tv(&v);
|
|
Karsten Hopp |
143428 |
PyErr_SET_VIM(N_("internal error: failed to add item to list"));
|
|
Karsten Hopp |
143428 |
+ list_restore(numadded, numreplaced, slicelen, l, lis, lastaddedli);
|
|
Karsten Hopp |
143428 |
+ PyMem_Free(lis);
|
|
Karsten Hopp |
143428 |
return -1;
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
+ if (numreplaced < slicelen)
|
|
Karsten Hopp |
143428 |
+ {
|
|
Karsten Hopp |
143428 |
+ lis[slicelen + numreplaced] = lis[numreplaced]->li_prev;
|
|
Karsten Hopp |
143428 |
+ list_remove(l, lis[numreplaced], lis[numreplaced]);
|
|
Karsten Hopp |
143428 |
+ numreplaced++;
|
|
Karsten Hopp |
143428 |
+ }
|
|
Karsten Hopp |
143428 |
+ else
|
|
Karsten Hopp |
143428 |
+ {
|
|
Karsten Hopp |
143428 |
+ if (li)
|
|
Karsten Hopp |
143428 |
+ lastaddedli = li->li_prev;
|
|
Karsten Hopp |
143428 |
+ else
|
|
Karsten Hopp |
143428 |
+ lastaddedli = l->lv_last;
|
|
Karsten Hopp |
143428 |
+ numadded++;
|
|
Karsten Hopp |
143428 |
+ }
|
|
Karsten Hopp |
143428 |
clear_tv(&v);
|
|
Karsten Hopp |
143428 |
+ if (step != 1 && i >= slicelen)
|
|
Karsten Hopp |
143428 |
+ {
|
|
Karsten Hopp |
143428 |
+ Py_DECREF(iterator);
|
|
Karsten Hopp |
143428 |
+ PyErr_FORMAT(PyExc_ValueError,
|
|
Karsten Hopp |
143428 |
+ N_("attempt to assign sequence of size greater then %d "
|
|
Karsten Hopp |
143428 |
+ "to extended slice"), slicelen);
|
|
Karsten Hopp |
143428 |
+ list_restore(numadded, numreplaced, slicelen, l, lis, lastaddedli);
|
|
Karsten Hopp |
143428 |
+ PyMem_Free(lis);
|
|
Karsten Hopp |
143428 |
+ return -1;
|
|
Karsten Hopp |
143428 |
+ }
|
|
Karsten Hopp |
143428 |
+ ++i;
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
Py_DECREF(iterator);
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
+ if (step != 1 && i != slicelen)
|
|
Karsten Hopp |
143428 |
+ {
|
|
Karsten Hopp |
143428 |
+ PyErr_FORMAT2(PyExc_ValueError,
|
|
Karsten Hopp |
143428 |
+ N_("attempt to assign sequence of size %d to extended slice "
|
|
Karsten Hopp |
143428 |
+ "of size %d"), i, slicelen);
|
|
Karsten Hopp |
143428 |
+ list_restore(numadded, numreplaced, slicelen, l, lis, lastaddedli);
|
|
Karsten Hopp |
143428 |
+ PyMem_Free(lis);
|
|
Karsten Hopp |
143428 |
+ return -1;
|
|
Karsten Hopp |
143428 |
+ }
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
if (PyErr_Occurred())
|
|
Karsten Hopp |
143428 |
+ {
|
|
Karsten Hopp |
143428 |
+ list_restore(numadded, numreplaced, slicelen, l, lis, lastaddedli);
|
|
Karsten Hopp |
143428 |
+ PyMem_Free(lis);
|
|
Karsten Hopp |
143428 |
return -1;
|
|
Karsten Hopp |
143428 |
+ }
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
+ for (i = 0; i < numreplaced; i++)
|
|
Karsten Hopp |
143428 |
+ listitem_free(lis[i]);
|
|
Karsten Hopp |
143428 |
+ if (step == 1)
|
|
Karsten Hopp |
143428 |
+ for (i = numreplaced; i < slicelen; i++)
|
|
Karsten Hopp |
143428 |
+ listitem_remove(l, lis[i]);
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
+ PyMem_Free(lis);
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
return 0;
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
+ static int
|
|
Karsten Hopp |
143428 |
+ ListAssIndex(ListObject *self, Py_ssize_t index, PyObject *obj)
|
|
Karsten Hopp |
143428 |
+ {
|
|
Karsten Hopp |
143428 |
+ typval_T tv;
|
|
Karsten Hopp |
143428 |
+ list_T *l = self->list;
|
|
Karsten Hopp |
143428 |
+ listitem_T *li;
|
|
Karsten Hopp |
143428 |
+ Py_ssize_t length = ListLength(self);
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
+ if (l->lv_lock)
|
|
Karsten Hopp |
143428 |
+ {
|
|
Karsten Hopp |
143428 |
+ RAISE_LOCKED_LIST;
|
|
Karsten Hopp |
143428 |
+ return -1;
|
|
Karsten Hopp |
143428 |
+ }
|
|
Karsten Hopp |
143428 |
+ if (index > length || (index == length && obj == NULL))
|
|
Karsten Hopp |
143428 |
+ {
|
|
Karsten Hopp |
143428 |
+ PyErr_SET_STRING(PyExc_IndexError, N_("list index out of range"));
|
|
Karsten Hopp |
143428 |
+ return -1;
|
|
Karsten Hopp |
143428 |
+ }
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
+ if (obj == NULL)
|
|
Karsten Hopp |
143428 |
+ {
|
|
Karsten Hopp |
143428 |
+ li = list_find(l, (long) index);
|
|
Karsten Hopp |
143428 |
+ list_remove(l, li, li);
|
|
Karsten Hopp |
143428 |
+ clear_tv(&li->li_tv);
|
|
Karsten Hopp |
143428 |
+ vim_free(li);
|
|
Karsten Hopp |
143428 |
+ return 0;
|
|
Karsten Hopp |
143428 |
+ }
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
+ if (ConvertFromPyObject(obj, &tv) == -1)
|
|
Karsten Hopp |
143428 |
+ return -1;
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
+ if (index == length)
|
|
Karsten Hopp |
143428 |
+ {
|
|
Karsten Hopp |
143428 |
+ if (list_append_tv(l, &tv) == FAIL)
|
|
Karsten Hopp |
143428 |
+ {
|
|
Karsten Hopp |
143428 |
+ clear_tv(&tv;;
|
|
Karsten Hopp |
143428 |
+ PyErr_SET_VIM(N_("failed to add item to list"));
|
|
Karsten Hopp |
143428 |
+ return -1;
|
|
Karsten Hopp |
143428 |
+ }
|
|
Karsten Hopp |
143428 |
+ }
|
|
Karsten Hopp |
143428 |
+ else
|
|
Karsten Hopp |
143428 |
+ {
|
|
Karsten Hopp |
143428 |
+ li = list_find(l, (long) index);
|
|
Karsten Hopp |
143428 |
+ clear_tv(&li->li_tv);
|
|
Karsten Hopp |
143428 |
+ copy_tv(&tv, &li->li_tv);
|
|
Karsten Hopp |
143428 |
+ clear_tv(&tv;;
|
|
Karsten Hopp |
143428 |
+ }
|
|
Karsten Hopp |
143428 |
+ return 0;
|
|
Karsten Hopp |
143428 |
+ }
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
+ static Py_ssize_t
|
|
Karsten Hopp |
143428 |
+ ListAssItem(ListObject *self, PyObject *idx, PyObject *obj)
|
|
Karsten Hopp |
143428 |
+ {
|
|
Karsten Hopp |
143428 |
+ #if PY_MAJOR_VERSION < 3
|
|
Karsten Hopp |
143428 |
+ if (PyInt_Check(idx))
|
|
Karsten Hopp |
143428 |
+ {
|
|
Karsten Hopp |
143428 |
+ long _idx = PyInt_AsLong(idx);
|
|
Karsten Hopp |
143428 |
+ return ListAssIndex(self, _idx, obj);
|
|
Karsten Hopp |
143428 |
+ }
|
|
Karsten Hopp |
143428 |
+ else
|
|
Karsten Hopp |
143428 |
+ #endif
|
|
Karsten Hopp |
143428 |
+ if (PyLong_Check(idx))
|
|
Karsten Hopp |
143428 |
+ {
|
|
Karsten Hopp |
143428 |
+ long _idx = PyLong_AsLong(idx);
|
|
Karsten Hopp |
143428 |
+ return ListAssIndex(self, _idx, obj);
|
|
Karsten Hopp |
143428 |
+ }
|
|
Karsten Hopp |
143428 |
+ else if (PySlice_Check(idx))
|
|
Karsten Hopp |
143428 |
+ {
|
|
Karsten Hopp |
143428 |
+ Py_ssize_t start, stop, step, slicelen;
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
+ if (PySlice_GetIndicesEx(idx, ListLength(self),
|
|
Karsten Hopp |
143428 |
+ &start, &stop, &step, &slicelen) < 0)
|
|
Karsten Hopp |
143428 |
+ return -1;
|
|
Karsten Hopp |
143428 |
+ return ListAssSlice(self, start, step, slicelen,
|
|
Karsten Hopp |
143428 |
+ obj);
|
|
Karsten Hopp |
143428 |
+ }
|
|
Karsten Hopp |
143428 |
+ else
|
|
Karsten Hopp |
143428 |
+ {
|
|
Karsten Hopp |
143428 |
+ RAISE_INVALID_INDEX_TYPE(idx);
|
|
Karsten Hopp |
143428 |
+ return -1;
|
|
Karsten Hopp |
143428 |
+ }
|
|
Karsten Hopp |
143428 |
+ }
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
static PyObject *
|
|
Karsten Hopp |
143428 |
ListConcatInPlace(ListObject *self, PyObject *obj)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 2520,2525 ****
|
|
Karsten Hopp |
143428 |
--- 2655,2710 ----
|
|
Karsten Hopp |
143428 |
return (PyObject *)(self);
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
+ typedef struct
|
|
Karsten Hopp |
143428 |
+ {
|
|
Karsten Hopp |
143428 |
+ listwatch_T lw;
|
|
Karsten Hopp |
143428 |
+ list_T *list;
|
|
Karsten Hopp |
143428 |
+ } listiterinfo_T;
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
+ static void
|
|
Karsten Hopp |
143428 |
+ ListIterDestruct(listiterinfo_T *lii)
|
|
Karsten Hopp |
143428 |
+ {
|
|
Karsten Hopp |
143428 |
+ list_rem_watch(lii->list, &lii->lw);
|
|
Karsten Hopp |
143428 |
+ PyMem_Free(lii);
|
|
Karsten Hopp |
143428 |
+ }
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
+ static PyObject *
|
|
Karsten Hopp |
143428 |
+ ListIterNext(listiterinfo_T **lii)
|
|
Karsten Hopp |
143428 |
+ {
|
|
Karsten Hopp |
143428 |
+ PyObject *ret;
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
+ if (!((*lii)->lw.lw_item))
|
|
Karsten Hopp |
143428 |
+ return NULL;
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
+ if (!(ret = ConvertToPyObject(&((*lii)->lw.lw_item->li_tv))))
|
|
Karsten Hopp |
143428 |
+ return NULL;
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
+ (*lii)->lw.lw_item = (*lii)->lw.lw_item->li_next;
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
+ return ret;
|
|
Karsten Hopp |
143428 |
+ }
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
+ static PyObject *
|
|
Karsten Hopp |
143428 |
+ ListIter(ListObject *self)
|
|
Karsten Hopp |
143428 |
+ {
|
|
Karsten Hopp |
143428 |
+ listiterinfo_T *lii;
|
|
Karsten Hopp |
143428 |
+ list_T *l = self->list;
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
+ if (!(lii = PyMem_New(listiterinfo_T, 1)))
|
|
Karsten Hopp |
143428 |
+ {
|
|
Karsten Hopp |
143428 |
+ PyErr_NoMemory();
|
|
Karsten Hopp |
143428 |
+ return NULL;
|
|
Karsten Hopp |
143428 |
+ }
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
+ list_add_watch(l, &lii->lw);
|
|
Karsten Hopp |
143428 |
+ lii->lw.lw_item = l->lv_first;
|
|
Karsten Hopp |
143428 |
+ lii->list = l;
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
+ return IterNew(lii,
|
|
Karsten Hopp |
143428 |
+ (destructorfun) ListIterDestruct, (nextfun) ListIterNext,
|
|
Karsten Hopp |
143428 |
+ NULL, NULL);
|
|
Karsten Hopp |
143428 |
+ }
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
static char *ListAttrs[] = {
|
|
Karsten Hopp |
143428 |
"locked",
|
|
Karsten Hopp |
143428 |
NULL
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 2567,2572 ****
|
|
Karsten Hopp |
143428 |
--- 2752,2776 ----
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
+ static PySequenceMethods ListAsSeq = {
|
|
Karsten Hopp |
143428 |
+ (lenfunc) ListLength, /* sq_length, len(x) */
|
|
Karsten Hopp |
143428 |
+ (binaryfunc) 0, /* RangeConcat, sq_concat, x+y */
|
|
Karsten Hopp |
143428 |
+ 0, /* RangeRepeat, sq_repeat, x*n */
|
|
Karsten Hopp |
143428 |
+ (PyIntArgFunc) ListIndex, /* sq_item, x[i] */
|
|
Karsten Hopp |
143428 |
+ 0, /* was_sq_slice, x[i:j] */
|
|
Karsten Hopp |
143428 |
+ (PyIntObjArgProc) ListAssIndex, /* sq_as_item, x[i]=v */
|
|
Karsten Hopp |
143428 |
+ 0, /* was_sq_ass_slice, x[i:j]=v */
|
|
Karsten Hopp |
143428 |
+ 0, /* sq_contains */
|
|
Karsten Hopp |
143428 |
+ (binaryfunc) ListConcatInPlace,/* sq_inplace_concat */
|
|
Karsten Hopp |
143428 |
+ 0, /* sq_inplace_repeat */
|
|
Karsten Hopp |
143428 |
+ };
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
+ static PyMappingMethods ListAsMapping = {
|
|
Karsten Hopp |
143428 |
+ /* mp_length */ (lenfunc) ListLength,
|
|
Karsten Hopp |
143428 |
+ /* mp_subscript */ (binaryfunc) ListItem,
|
|
Karsten Hopp |
143428 |
+ /* mp_ass_subscript */ (objobjargproc) ListAssItem,
|
|
Karsten Hopp |
143428 |
+ };
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
static struct PyMethodDef ListMethods[] = {
|
|
Karsten Hopp |
143428 |
{"extend", (PyCFunction)ListConcatInPlace, METH_O, ""},
|
|
Karsten Hopp |
143428 |
{"__dir__", (PyCFunction)ListDir, METH_NOARGS, ""},
|
|
Karsten Hopp |
143428 |
*** ../vim-7.4.150/src/if_python3.c 2013-11-03 00:28:20.000000000 +0100
|
|
Karsten Hopp |
143428 |
--- src/if_python3.c 2014-01-14 16:32:40.000000000 +0100
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 97,102 ****
|
|
Karsten Hopp |
143428 |
--- 97,105 ----
|
|
Karsten Hopp |
143428 |
#define Py_ssize_t_fmt "n"
|
|
Karsten Hopp |
143428 |
#define Py_bytes_fmt "y"
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
+ #define PyIntArgFunc ssizeargfunc
|
|
Karsten Hopp |
143428 |
+ #define PyIntObjArgProc ssizeobjargproc
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
#if defined(DYNAMIC_PYTHON3) || defined(PROTO)
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
# ifndef WIN3264
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 292,298 ****
|
|
Karsten Hopp |
143428 |
static int (*py3_PyMapping_Check)(PyObject *);
|
|
Karsten Hopp |
143428 |
static PyObject* (*py3_PyMapping_Keys)(PyObject *);
|
|
Karsten Hopp |
143428 |
static int (*py3_PySlice_GetIndicesEx)(PyObject *r, Py_ssize_t length,
|
|
Karsten Hopp |
143428 |
! Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, Py_ssize_t *slicelength);
|
|
Karsten Hopp |
143428 |
static PyObject* (*py3_PyErr_NoMemory)(void);
|
|
Karsten Hopp |
143428 |
static void (*py3_Py_Finalize)(void);
|
|
Karsten Hopp |
143428 |
static void (*py3_PyErr_SetString)(PyObject *, const char *);
|
|
Karsten Hopp |
143428 |
--- 295,302 ----
|
|
Karsten Hopp |
143428 |
static int (*py3_PyMapping_Check)(PyObject *);
|
|
Karsten Hopp |
143428 |
static PyObject* (*py3_PyMapping_Keys)(PyObject *);
|
|
Karsten Hopp |
143428 |
static int (*py3_PySlice_GetIndicesEx)(PyObject *r, Py_ssize_t length,
|
|
Karsten Hopp |
143428 |
! Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step,
|
|
Karsten Hopp |
143428 |
! Py_ssize_t *slicelen);
|
|
Karsten Hopp |
143428 |
static PyObject* (*py3_PyErr_NoMemory)(void);
|
|
Karsten Hopp |
143428 |
static void (*py3_Py_Finalize)(void);
|
|
Karsten Hopp |
143428 |
static void (*py3_PyErr_SetString)(PyObject *, const char *);
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 1478,1553 ****
|
|
Karsten Hopp |
143428 |
/* List object - Definitions
|
|
Karsten Hopp |
143428 |
*/
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
- static PySequenceMethods ListAsSeq = {
|
|
Karsten Hopp |
143428 |
- (lenfunc) ListLength, /* sq_length, len(x) */
|
|
Karsten Hopp |
143428 |
- (binaryfunc) 0, /* RangeConcat, sq_concat, x+y */
|
|
Karsten Hopp |
143428 |
- (ssizeargfunc) 0, /* RangeRepeat, sq_repeat, x*n */
|
|
Karsten Hopp |
143428 |
- (ssizeargfunc) ListItem, /* sq_item, x[i] */
|
|
Karsten Hopp |
143428 |
- (void *) 0, /* was_sq_slice, x[i:j] */
|
|
Karsten Hopp |
143428 |
- (ssizeobjargproc) ListAssItem, /* sq_as_item, x[i]=v */
|
|
Karsten Hopp |
143428 |
- (void *) 0, /* was_sq_ass_slice, x[i:j]=v */
|
|
Karsten Hopp |
143428 |
- 0, /* sq_contains */
|
|
Karsten Hopp |
143428 |
- (binaryfunc) ListConcatInPlace,/* sq_inplace_concat */
|
|
Karsten Hopp |
143428 |
- 0, /* sq_inplace_repeat */
|
|
Karsten Hopp |
143428 |
- };
|
|
Karsten Hopp |
143428 |
-
|
|
Karsten Hopp |
143428 |
- static PyObject *ListSubscript(PyObject *, PyObject *);
|
|
Karsten Hopp |
143428 |
- static Py_ssize_t ListAsSubscript(PyObject *, PyObject *, PyObject *);
|
|
Karsten Hopp |
143428 |
-
|
|
Karsten Hopp |
143428 |
- static PyMappingMethods ListAsMapping = {
|
|
Karsten Hopp |
143428 |
- /* mp_length */ (lenfunc) ListLength,
|
|
Karsten Hopp |
143428 |
- /* mp_subscript */ (binaryfunc) ListSubscript,
|
|
Karsten Hopp |
143428 |
- /* mp_ass_subscript */ (objobjargproc) ListAsSubscript,
|
|
Karsten Hopp |
143428 |
- };
|
|
Karsten Hopp |
143428 |
-
|
|
Karsten Hopp |
143428 |
- static PyObject *
|
|
Karsten Hopp |
143428 |
- ListSubscript(PyObject *self, PyObject* idx)
|
|
Karsten Hopp |
143428 |
- {
|
|
Karsten Hopp |
143428 |
- if (PyLong_Check(idx))
|
|
Karsten Hopp |
143428 |
- {
|
|
Karsten Hopp |
143428 |
- long _idx = PyLong_AsLong(idx);
|
|
Karsten Hopp |
143428 |
- return ListItem((ListObject *)(self), _idx);
|
|
Karsten Hopp |
143428 |
- }
|
|
Karsten Hopp |
143428 |
- else if (PySlice_Check(idx))
|
|
Karsten Hopp |
143428 |
- {
|
|
Karsten Hopp |
143428 |
- Py_ssize_t start, stop, step, slicelen;
|
|
Karsten Hopp |
143428 |
-
|
|
Karsten Hopp |
143428 |
- if (PySlice_GetIndicesEx(idx, ListLength((ListObject *)(self)),
|
|
Karsten Hopp |
143428 |
- &start, &stop, &step, &slicelen) < 0)
|
|
Karsten Hopp |
143428 |
- return NULL;
|
|
Karsten Hopp |
143428 |
- return ListSlice((ListObject *)(self), start, stop);
|
|
Karsten Hopp |
143428 |
- }
|
|
Karsten Hopp |
143428 |
- else
|
|
Karsten Hopp |
143428 |
- {
|
|
Karsten Hopp |
143428 |
- RAISE_INVALID_INDEX_TYPE(idx);
|
|
Karsten Hopp |
143428 |
- return NULL;
|
|
Karsten Hopp |
143428 |
- }
|
|
Karsten Hopp |
143428 |
- }
|
|
Karsten Hopp |
143428 |
-
|
|
Karsten Hopp |
143428 |
- static Py_ssize_t
|
|
Karsten Hopp |
143428 |
- ListAsSubscript(PyObject *self, PyObject *idx, PyObject *obj)
|
|
Karsten Hopp |
143428 |
- {
|
|
Karsten Hopp |
143428 |
- if (PyLong_Check(idx))
|
|
Karsten Hopp |
143428 |
- {
|
|
Karsten Hopp |
143428 |
- long _idx = PyLong_AsLong(idx);
|
|
Karsten Hopp |
143428 |
- return ListAssItem((ListObject *)(self), _idx, obj);
|
|
Karsten Hopp |
143428 |
- }
|
|
Karsten Hopp |
143428 |
- else if (PySlice_Check(idx))
|
|
Karsten Hopp |
143428 |
- {
|
|
Karsten Hopp |
143428 |
- Py_ssize_t start, stop, step, slicelen;
|
|
Karsten Hopp |
143428 |
-
|
|
Karsten Hopp |
143428 |
- if (PySlice_GetIndicesEx(idx, ListLength((ListObject *)(self)),
|
|
Karsten Hopp |
143428 |
- &start, &stop, &step, &slicelen) < 0)
|
|
Karsten Hopp |
143428 |
- return -1;
|
|
Karsten Hopp |
143428 |
- return ListAssSlice((ListObject *)(self), start, stop, obj);
|
|
Karsten Hopp |
143428 |
- }
|
|
Karsten Hopp |
143428 |
- else
|
|
Karsten Hopp |
143428 |
- {
|
|
Karsten Hopp |
143428 |
- RAISE_INVALID_INDEX_TYPE(idx);
|
|
Karsten Hopp |
143428 |
- return -1;
|
|
Karsten Hopp |
143428 |
- }
|
|
Karsten Hopp |
143428 |
- }
|
|
Karsten Hopp |
143428 |
-
|
|
Karsten Hopp |
143428 |
static PyObject *
|
|
Karsten Hopp |
143428 |
ListGetattro(PyObject *self, PyObject *nameobj)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
--- 1482,1487 ----
|
|
Karsten Hopp |
143428 |
*** ../vim-7.4.150/src/if_python.c 2013-11-03 00:28:20.000000000 +0100
|
|
Karsten Hopp |
143428 |
--- src/if_python.c 2014-01-14 16:24:49.000000000 +0100
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 196,201 ****
|
|
Karsten Hopp |
143428 |
--- 196,202 ----
|
|
Karsten Hopp |
143428 |
# define PyTuple_Size dll_PyTuple_Size
|
|
Karsten Hopp |
143428 |
# define PyTuple_GetItem dll_PyTuple_GetItem
|
|
Karsten Hopp |
143428 |
# define PyTuple_Type (*dll_PyTuple_Type)
|
|
Karsten Hopp |
143428 |
+ # define PySlice_GetIndicesEx dll_PySlice_GetIndicesEx
|
|
Karsten Hopp |
143428 |
# define PyImport_ImportModule dll_PyImport_ImportModule
|
|
Karsten Hopp |
143428 |
# define PyDict_New dll_PyDict_New
|
|
Karsten Hopp |
143428 |
# define PyDict_GetItemString dll_PyDict_GetItemString
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 241,246 ****
|
|
Karsten Hopp |
143428 |
--- 242,248 ----
|
|
Karsten Hopp |
143428 |
# define PySys_GetObject dll_PySys_GetObject
|
|
Karsten Hopp |
143428 |
# define PySys_SetArgv dll_PySys_SetArgv
|
|
Karsten Hopp |
143428 |
# define PyType_Type (*dll_PyType_Type)
|
|
Karsten Hopp |
143428 |
+ # define PySlice_Type (*dll_PySlice_Type)
|
|
Karsten Hopp |
143428 |
# define PyType_Ready (*dll_PyType_Ready)
|
|
Karsten Hopp |
143428 |
# define PyType_GenericAlloc dll_PyType_GenericAlloc
|
|
Karsten Hopp |
143428 |
# define Py_BuildValue dll_Py_BuildValue
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 341,346 ****
|
|
Karsten Hopp |
143428 |
--- 343,351 ----
|
|
Karsten Hopp |
143428 |
static PyInt(*dll_PyTuple_Size)(PyObject *);
|
|
Karsten Hopp |
143428 |
static PyObject*(*dll_PyTuple_GetItem)(PyObject *, PyInt);
|
|
Karsten Hopp |
143428 |
static PyTypeObject* dll_PyTuple_Type;
|
|
Karsten Hopp |
143428 |
+ static int (*dll_PySlice_GetIndicesEx)(PyObject *r, PyInt length,
|
|
Karsten Hopp |
143428 |
+ PyInt *start, PyInt *stop, PyInt *step,
|
|
Karsten Hopp |
143428 |
+ PyInt *slicelen);
|
|
Karsten Hopp |
143428 |
static PyObject*(*dll_PyImport_ImportModule)(const char *);
|
|
Karsten Hopp |
143428 |
static PyObject*(*dll_PyDict_New)(void);
|
|
Karsten Hopp |
143428 |
static PyObject*(*dll_PyDict_GetItemString)(PyObject *, const char *);
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 382,387 ****
|
|
Karsten Hopp |
143428 |
--- 387,393 ----
|
|
Karsten Hopp |
143428 |
static PyObject *(*dll_PySys_GetObject)(char *);
|
|
Karsten Hopp |
143428 |
static int(*dll_PySys_SetArgv)(int, char **);
|
|
Karsten Hopp |
143428 |
static PyTypeObject* dll_PyType_Type;
|
|
Karsten Hopp |
143428 |
+ static PyTypeObject* dll_PySlice_Type;
|
|
Karsten Hopp |
143428 |
static int (*dll_PyType_Ready)(PyTypeObject *type);
|
|
Karsten Hopp |
143428 |
static PyObject* (*dll_PyType_GenericAlloc)(PyTypeObject *type, PyInt nitems);
|
|
Karsten Hopp |
143428 |
static PyObject*(*dll_Py_BuildValue)(char *, ...);
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 521,526 ****
|
|
Karsten Hopp |
143428 |
--- 527,533 ----
|
|
Karsten Hopp |
143428 |
{"PyTuple_GetItem", (PYTHON_PROC*)&dll_PyTuple_GetItem},
|
|
Karsten Hopp |
143428 |
{"PyTuple_Size", (PYTHON_PROC*)&dll_PyTuple_Size},
|
|
Karsten Hopp |
143428 |
{"PyTuple_Type", (PYTHON_PROC*)&dll_PyTuple_Type},
|
|
Karsten Hopp |
143428 |
+ {"PySlice_GetIndicesEx", (PYTHON_PROC*)&dll_PySlice_GetIndicesEx},
|
|
Karsten Hopp |
143428 |
{"PyImport_ImportModule", (PYTHON_PROC*)&dll_PyImport_ImportModule},
|
|
Karsten Hopp |
143428 |
{"PyDict_GetItemString", (PYTHON_PROC*)&dll_PyDict_GetItemString},
|
|
Karsten Hopp |
143428 |
{"PyDict_Next", (PYTHON_PROC*)&dll_PyDict_Next},
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 562,567 ****
|
|
Karsten Hopp |
143428 |
--- 569,575 ----
|
|
Karsten Hopp |
143428 |
{"PySys_GetObject", (PYTHON_PROC*)&dll_PySys_GetObject},
|
|
Karsten Hopp |
143428 |
{"PySys_SetArgv", (PYTHON_PROC*)&dll_PySys_SetArgv},
|
|
Karsten Hopp |
143428 |
{"PyType_Type", (PYTHON_PROC*)&dll_PyType_Type},
|
|
Karsten Hopp |
143428 |
+ {"PySlice_Type", (PYTHON_PROC*)&dll_PySlice_Type},
|
|
Karsten Hopp |
143428 |
{"PyType_Ready", (PYTHON_PROC*)&dll_PyType_Ready},
|
|
Karsten Hopp |
143428 |
{"PyType_GenericAlloc", (PYTHON_PROC*)&dll_PyType_GenericAlloc},
|
|
Karsten Hopp |
143428 |
{"Py_FindMethod", (PYTHON_PROC*)&dll_Py_FindMethod},
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 1472,1492 ****
|
|
Karsten Hopp |
143428 |
return Py_FindMethod(DictionaryMethods, self, name);
|
|
Karsten Hopp |
143428 |
}
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
- static PySequenceMethods ListAsSeq = {
|
|
Karsten Hopp |
143428 |
- (PyInquiry) ListLength,
|
|
Karsten Hopp |
143428 |
- (binaryfunc) 0,
|
|
Karsten Hopp |
143428 |
- (PyIntArgFunc) 0,
|
|
Karsten Hopp |
143428 |
- (PyIntArgFunc) ListItem,
|
|
Karsten Hopp |
143428 |
- (PyIntIntArgFunc) ListSlice,
|
|
Karsten Hopp |
143428 |
- (PyIntObjArgProc) ListAssItem,
|
|
Karsten Hopp |
143428 |
- (PyIntIntObjArgProc) ListAssSlice,
|
|
Karsten Hopp |
143428 |
- (objobjproc) 0,
|
|
Karsten Hopp |
143428 |
- #if PY_MAJOR_VERSION >= 2
|
|
Karsten Hopp |
143428 |
- (binaryfunc) ListConcatInPlace,
|
|
Karsten Hopp |
143428 |
- 0,
|
|
Karsten Hopp |
143428 |
- #endif
|
|
Karsten Hopp |
143428 |
- };
|
|
Karsten Hopp |
143428 |
-
|
|
Karsten Hopp |
143428 |
static PyObject *
|
|
Karsten Hopp |
143428 |
ListGetattr(PyObject *self, char *name)
|
|
Karsten Hopp |
143428 |
{
|
|
Karsten Hopp |
143428 |
--- 1480,1485 ----
|
|
Karsten Hopp |
143428 |
*** ../vim-7.4.150/src/proto/eval.pro 2013-08-10 13:37:09.000000000 +0200
|
|
Karsten Hopp |
143428 |
--- src/proto/eval.pro 2014-01-14 16:24:49.000000000 +0100
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 60,65 ****
|
|
Karsten Hopp |
143428 |
--- 60,66 ----
|
|
Karsten Hopp |
143428 |
int list_append_string __ARGS((list_T *l, char_u *str, int len));
|
|
Karsten Hopp |
143428 |
int list_insert_tv __ARGS((list_T *l, typval_T *tv, listitem_T *item));
|
|
Karsten Hopp |
143428 |
void list_remove __ARGS((list_T *l, listitem_T *item, listitem_T *item2));
|
|
Karsten Hopp |
143428 |
+ void list_insert __ARGS((list_T *l, listitem_T *ni, listitem_T *item));
|
|
Karsten Hopp |
143428 |
int garbage_collect __ARGS((void));
|
|
Karsten Hopp |
143428 |
void set_ref_in_ht __ARGS((hashtab_T *ht, int copyID));
|
|
Karsten Hopp |
143428 |
void set_ref_in_list __ARGS((list_T *l, int copyID));
|
|
Karsten Hopp |
143428 |
*** ../vim-7.4.150/src/testdir/test86.in 2013-11-28 17:04:38.000000000 +0100
|
|
Karsten Hopp |
143428 |
--- src/testdir/test86.in 2014-01-14 16:24:49.000000000 +0100
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 135,140 ****
|
|
Karsten Hopp |
143428 |
--- 135,152 ----
|
|
Karsten Hopp |
143428 |
:py l=vim.bindeval('l')
|
|
Karsten Hopp |
143428 |
:py del l[-6:2]
|
|
Karsten Hopp |
143428 |
:$put =string(l)
|
|
Karsten Hopp |
143428 |
+ :let l = [0, 1, 2, 3]
|
|
Karsten Hopp |
143428 |
+ :py l=vim.bindeval('l')
|
|
Karsten Hopp |
143428 |
+ :py del l[::2]
|
|
Karsten Hopp |
143428 |
+ :$put =string(l)
|
|
Karsten Hopp |
143428 |
+ :let l = [0, 1, 2, 3]
|
|
Karsten Hopp |
143428 |
+ :py l=vim.bindeval('l')
|
|
Karsten Hopp |
143428 |
+ :py del l[3:0:-2]
|
|
Karsten Hopp |
143428 |
+ :$put =string(l)
|
|
Karsten Hopp |
143428 |
+ :let l = [0, 1, 2, 3]
|
|
Karsten Hopp |
143428 |
+ :py l=vim.bindeval('l')
|
|
Karsten Hopp |
143428 |
+ :py del l[2:4:-2]
|
|
Karsten Hopp |
143428 |
+ :$put =string(l)
|
|
Karsten Hopp |
143428 |
:"
|
|
Karsten Hopp |
143428 |
:" Slice assignment to a list
|
|
Karsten Hopp |
143428 |
:let l = [0, 1, 2, 3]
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 169,174 ****
|
|
Karsten Hopp |
143428 |
--- 181,206 ----
|
|
Karsten Hopp |
143428 |
:py l=vim.bindeval('l')
|
|
Karsten Hopp |
143428 |
:py l[0:0]=['h']
|
|
Karsten Hopp |
143428 |
:$put =string(l)
|
|
Karsten Hopp |
143428 |
+ :let l = range(8)
|
|
Karsten Hopp |
143428 |
+ :py l=vim.bindeval('l')
|
|
Karsten Hopp |
143428 |
+ :py l[2:6:2] = [10, 20]
|
|
Karsten Hopp |
143428 |
+ :$put =string(l)
|
|
Karsten Hopp |
143428 |
+ :let l = range(8)
|
|
Karsten Hopp |
143428 |
+ :py l=vim.bindeval('l')
|
|
Karsten Hopp |
143428 |
+ :py l[6:2:-2] = [10, 20]
|
|
Karsten Hopp |
143428 |
+ :$put =string(l)
|
|
Karsten Hopp |
143428 |
+ :let l = range(8)
|
|
Karsten Hopp |
143428 |
+ :py l=vim.bindeval('l')
|
|
Karsten Hopp |
143428 |
+ :py l[6:2] = ()
|
|
Karsten Hopp |
143428 |
+ :$put =string(l)
|
|
Karsten Hopp |
143428 |
+ :let l = range(8)
|
|
Karsten Hopp |
143428 |
+ :py l=vim.bindeval('l')
|
|
Karsten Hopp |
143428 |
+ :py l[6:2:1] = ()
|
|
Karsten Hopp |
143428 |
+ :$put =string(l)
|
|
Karsten Hopp |
143428 |
+ :let l = range(8)
|
|
Karsten Hopp |
143428 |
+ :py l=vim.bindeval('l')
|
|
Karsten Hopp |
143428 |
+ :py l[2:2:1] = ()
|
|
Karsten Hopp |
143428 |
+ :$put =string(l)
|
|
Karsten Hopp |
143428 |
:"
|
|
Karsten Hopp |
143428 |
:" Locked variables
|
|
Karsten Hopp |
143428 |
:let l = [0, 1, 2, 3]
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 390,395 ****
|
|
Karsten Hopp |
143428 |
--- 422,434 ----
|
|
Karsten Hopp |
143428 |
:$put =string(pyeval('l'))
|
|
Karsten Hopp |
143428 |
:py l = ll[-10:10]
|
|
Karsten Hopp |
143428 |
:$put =string(pyeval('l'))
|
|
Karsten Hopp |
143428 |
+ :py l = ll[4:2:-1]
|
|
Karsten Hopp |
143428 |
+ :$put =string(pyeval('l'))
|
|
Karsten Hopp |
143428 |
+ :py l = ll[::2]
|
|
Karsten Hopp |
143428 |
+ :$put =string(pyeval('l'))
|
|
Karsten Hopp |
143428 |
+ :py l = ll[4:2:1]
|
|
Karsten Hopp |
143428 |
+ :$put =string(pyeval('l'))
|
|
Karsten Hopp |
143428 |
+ :py del l
|
|
Karsten Hopp |
143428 |
:"
|
|
Karsten Hopp |
143428 |
:" Vars
|
|
Karsten Hopp |
143428 |
:let g:foo = 'bac'
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 907,912 ****
|
|
Karsten Hopp |
143428 |
--- 946,952 ----
|
|
Karsten Hopp |
143428 |
l = vim.List()
|
|
Karsten Hopp |
143428 |
ll = vim.List('abcE')
|
|
Karsten Hopp |
143428 |
ll.locked = True
|
|
Karsten Hopp |
143428 |
+ nel = vim.List('abcO')
|
|
Karsten Hopp |
143428 |
f = vim.Function('string')
|
|
Karsten Hopp |
143428 |
fd = vim.Function('F')
|
|
Karsten Hopp |
143428 |
fdel = vim.Function('D')
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 994,999 ****
|
|
Karsten Hopp |
143428 |
--- 1034,1053 ----
|
|
Karsten Hopp |
143428 |
def next(self):
|
|
Karsten Hopp |
143428 |
raise NotImplementedError('next')
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
+ class FailingIterNextN(object):
|
|
Karsten Hopp |
143428 |
+ def __init__(self, n):
|
|
Karsten Hopp |
143428 |
+ self.n = n
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
+ def __iter__(self):
|
|
Karsten Hopp |
143428 |
+ return self
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
+ def next(self):
|
|
Karsten Hopp |
143428 |
+ if self.n:
|
|
Karsten Hopp |
143428 |
+ self.n -= 1
|
|
Karsten Hopp |
143428 |
+ return 1
|
|
Karsten Hopp |
143428 |
+ else:
|
|
Karsten Hopp |
143428 |
+ raise NotImplementedError('next N')
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
class FailingMappingKey(object):
|
|
Karsten Hopp |
143428 |
def __getitem__(self, item):
|
|
Karsten Hopp |
143428 |
raise NotImplementedError('getitem:mappingkey')
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 1098,1103 ****
|
|
Karsten Hopp |
143428 |
--- 1152,1158 ----
|
|
Karsten Hopp |
143428 |
cb.append(">>> iter")
|
|
Karsten Hopp |
143428 |
ee('d.update(FailingMapping())')
|
|
Karsten Hopp |
143428 |
ee('d.update([FailingIterNext()])')
|
|
Karsten Hopp |
143428 |
+ ee('d.update([FailingIterNextN(1)])')
|
|
Karsten Hopp |
143428 |
iter_test('d.update(%s)')
|
|
Karsten Hopp |
143428 |
convertfrompyobject_test('d.update(%s)')
|
|
Karsten Hopp |
143428 |
stringtochars_test('d.update(((%s, 0),))')
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 1120,1125 ****
|
|
Karsten Hopp |
143428 |
--- 1175,1188 ----
|
|
Karsten Hopp |
143428 |
cb.append(">> ListAssSlice")
|
|
Karsten Hopp |
143428 |
ee('ll[1:100] = "abcJ"')
|
|
Karsten Hopp |
143428 |
iter_test('l[:] = %s')
|
|
Karsten Hopp |
143428 |
+ ee('nel[1:10:2] = "abcK"')
|
|
Karsten Hopp |
143428 |
+ cb.append(repr(tuple(nel)))
|
|
Karsten Hopp |
143428 |
+ ee('nel[1:10:2] = "a"')
|
|
Karsten Hopp |
143428 |
+ cb.append(repr(tuple(nel)))
|
|
Karsten Hopp |
143428 |
+ ee('nel[1:1:-1] = "a"')
|
|
Karsten Hopp |
143428 |
+ cb.append(repr(tuple(nel)))
|
|
Karsten Hopp |
143428 |
+ ee('nel[:] = FailingIterNextN(2)')
|
|
Karsten Hopp |
143428 |
+ cb.append(repr(tuple(nel)))
|
|
Karsten Hopp |
143428 |
convertfrompyobject_test('l[:] = [%s]')
|
|
Karsten Hopp |
143428 |
cb.append(">> ListConcatInPlace")
|
|
Karsten Hopp |
143428 |
iter_test('l.extend(%s)')
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 1201,1206 ****
|
|
Karsten Hopp |
143428 |
--- 1264,1270 ----
|
|
Karsten Hopp |
143428 |
del dl
|
|
Karsten Hopp |
143428 |
del l
|
|
Karsten Hopp |
143428 |
del ll
|
|
Karsten Hopp |
143428 |
+ del nel
|
|
Karsten Hopp |
143428 |
del f
|
|
Karsten Hopp |
143428 |
del fd
|
|
Karsten Hopp |
143428 |
del fdel
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 1214,1219 ****
|
|
Karsten Hopp |
143428 |
--- 1278,1284 ----
|
|
Karsten Hopp |
143428 |
del FailingTrue
|
|
Karsten Hopp |
143428 |
del FailingIter
|
|
Karsten Hopp |
143428 |
del FailingIterNext
|
|
Karsten Hopp |
143428 |
+ del FailingIterNextN
|
|
Karsten Hopp |
143428 |
del FailingMapping
|
|
Karsten Hopp |
143428 |
del FailingMappingKey
|
|
Karsten Hopp |
143428 |
del FailingList
|
|
Karsten Hopp |
143428 |
*** ../vim-7.4.150/src/testdir/test86.ok 2013-11-28 17:04:38.000000000 +0100
|
|
Karsten Hopp |
143428 |
--- src/testdir/test86.ok 2014-01-14 16:24:49.000000000 +0100
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 41,46 ****
|
|
Karsten Hopp |
143428 |
--- 41,49 ----
|
|
Karsten Hopp |
143428 |
[2, 3]
|
|
Karsten Hopp |
143428 |
[2, 3]
|
|
Karsten Hopp |
143428 |
[2, 3]
|
|
Karsten Hopp |
143428 |
+ [1, 3]
|
|
Karsten Hopp |
143428 |
+ [0, 2]
|
|
Karsten Hopp |
143428 |
+ [0, 1, 2, 3]
|
|
Karsten Hopp |
143428 |
['a', 0, 1, 2, 3]
|
|
Karsten Hopp |
143428 |
[0, 'b', 2, 3]
|
|
Karsten Hopp |
143428 |
[0, 1, 'c']
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 49,54 ****
|
|
Karsten Hopp |
143428 |
--- 52,62 ----
|
|
Karsten Hopp |
143428 |
['f', 2, 3]
|
|
Karsten Hopp |
143428 |
[0, 1, 'g', 2, 3]
|
|
Karsten Hopp |
143428 |
['h']
|
|
Karsten Hopp |
143428 |
+ [0, 1, 10, 3, 20, 5, 6, 7]
|
|
Karsten Hopp |
143428 |
+ [0, 1, 2, 3, 20, 5, 10, 7]
|
|
Karsten Hopp |
143428 |
+ [0, 1, 2, 3, 4, 5, 6, 7]
|
|
Karsten Hopp |
143428 |
+ [0, 1, 2, 3, 4, 5, 6, 7]
|
|
Karsten Hopp |
143428 |
+ [0, 1, 2, 3, 4, 5, 6, 7]
|
|
Karsten Hopp |
143428 |
[0, 1, 2, 3]
|
|
Karsten Hopp |
143428 |
[function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd']
|
|
Karsten Hopp |
143428 |
[function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd', 'DictNewStart', 1, 2, 3, 'DictNewEnd', {'a': 'b'}]
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 96,101 ****
|
|
Karsten Hopp |
143428 |
--- 104,112 ----
|
|
Karsten Hopp |
143428 |
[0, 1, 2, 3, 4, 5]
|
|
Karsten Hopp |
143428 |
[0, 1, 2, 3, 4, 5]
|
|
Karsten Hopp |
143428 |
[0, 1, 2, 3, 4, 5]
|
|
Karsten Hopp |
143428 |
+ [4, 3]
|
|
Karsten Hopp |
143428 |
+ [0, 2, 4]
|
|
Karsten Hopp |
143428 |
+ []
|
|
Karsten Hopp |
143428 |
Abc
|
|
Karsten Hopp |
143428 |
bac
|
|
Karsten Hopp |
143428 |
def
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 599,604 ****
|
|
Karsten Hopp |
143428 |
--- 610,616 ----
|
|
Karsten Hopp |
143428 |
>>> iter
|
|
Karsten Hopp |
143428 |
d.update(FailingMapping()):NotImplementedError:('keys',)
|
|
Karsten Hopp |
143428 |
d.update([FailingIterNext()]):NotImplementedError:('next',)
|
|
Karsten Hopp |
143428 |
+ d.update([FailingIterNextN(1)]):NotImplementedError:('next N',)
|
|
Karsten Hopp |
143428 |
>>> Testing *Iter* using d.update(%s)
|
|
Karsten Hopp |
143428 |
d.update(FailingIter()):NotImplementedError:('iter',)
|
|
Karsten Hopp |
143428 |
d.update(FailingIterNext()):NotImplementedError:('next',)
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 829,834 ****
|
|
Karsten Hopp |
143428 |
--- 841,854 ----
|
|
Karsten Hopp |
143428 |
l[:] = FailingIter():NotImplementedError:('iter',)
|
|
Karsten Hopp |
143428 |
l[:] = FailingIterNext():NotImplementedError:('next',)
|
|
Karsten Hopp |
143428 |
<<< Finished
|
|
Karsten Hopp |
143428 |
+ nel[1:10:2] = "abcK":ValueError:('attempt to assign sequence of size greater then 2 to extended slice',)
|
|
Karsten Hopp |
143428 |
+ ('a', 'b', 'c', 'O')
|
|
Karsten Hopp |
143428 |
+ nel[1:10:2] = "a":ValueError:('attempt to assign sequence of size 1 to extended slice of size 2',)
|
|
Karsten Hopp |
143428 |
+ ('a', 'b', 'c', 'O')
|
|
Karsten Hopp |
143428 |
+ nel[1:1:-1] = "a":ValueError:('attempt to assign sequence of size greater then 0 to extended slice',)
|
|
Karsten Hopp |
143428 |
+ ('a', 'b', 'c', 'O')
|
|
Karsten Hopp |
143428 |
+ nel[:] = FailingIterNextN(2):NotImplementedError:('next N',)
|
|
Karsten Hopp |
143428 |
+ ('a', 'b', 'c', 'O')
|
|
Karsten Hopp |
143428 |
>>> Testing StringToChars using l[:] = [{%s : 1}]
|
|
Karsten Hopp |
143428 |
l[:] = [{1 : 1}]:TypeError:('expected str() or unicode() instance, but got int',)
|
|
Karsten Hopp |
143428 |
l[:] = [{u"\0" : 1}]:TypeError:('expected string without null bytes',)
|
|
Karsten Hopp |
143428 |
*** ../vim-7.4.150/src/testdir/test87.in 2013-11-28 17:04:38.000000000 +0100
|
|
Karsten Hopp |
143428 |
--- src/testdir/test87.in 2014-01-14 16:24:49.000000000 +0100
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 128,133 ****
|
|
Karsten Hopp |
143428 |
--- 128,145 ----
|
|
Karsten Hopp |
143428 |
:py3 l=vim.bindeval('l')
|
|
Karsten Hopp |
143428 |
:py3 del l[-6:2]
|
|
Karsten Hopp |
143428 |
:$put =string(l)
|
|
Karsten Hopp |
143428 |
+ :let l = [0, 1, 2, 3]
|
|
Karsten Hopp |
143428 |
+ :py3 l=vim.bindeval('l')
|
|
Karsten Hopp |
143428 |
+ :py3 del l[::2]
|
|
Karsten Hopp |
143428 |
+ :$put =string(l)
|
|
Karsten Hopp |
143428 |
+ :let l = [0, 1, 2, 3]
|
|
Karsten Hopp |
143428 |
+ :py3 l=vim.bindeval('l')
|
|
Karsten Hopp |
143428 |
+ :py3 del l[3:0:-2]
|
|
Karsten Hopp |
143428 |
+ :$put =string(l)
|
|
Karsten Hopp |
143428 |
+ :let l = [0, 1, 2, 3]
|
|
Karsten Hopp |
143428 |
+ :py3 l=vim.bindeval('l')
|
|
Karsten Hopp |
143428 |
+ :py3 del l[2:4:-2]
|
|
Karsten Hopp |
143428 |
+ :$put =string(l)
|
|
Karsten Hopp |
143428 |
:"
|
|
Karsten Hopp |
143428 |
:" Slice assignment to a list
|
|
Karsten Hopp |
143428 |
:let l = [0, 1, 2, 3]
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 162,167 ****
|
|
Karsten Hopp |
143428 |
--- 174,199 ----
|
|
Karsten Hopp |
143428 |
:py3 l=vim.bindeval('l')
|
|
Karsten Hopp |
143428 |
:py3 l[0:0]=['h']
|
|
Karsten Hopp |
143428 |
:$put =string(l)
|
|
Karsten Hopp |
143428 |
+ :let l = range(8)
|
|
Karsten Hopp |
143428 |
+ :py3 l=vim.bindeval('l')
|
|
Karsten Hopp |
143428 |
+ :py3 l[2:6:2] = [10, 20]
|
|
Karsten Hopp |
143428 |
+ :$put =string(l)
|
|
Karsten Hopp |
143428 |
+ :let l = range(8)
|
|
Karsten Hopp |
143428 |
+ :py3 l=vim.bindeval('l')
|
|
Karsten Hopp |
143428 |
+ :py3 l[6:2:-2] = [10, 20]
|
|
Karsten Hopp |
143428 |
+ :$put =string(l)
|
|
Karsten Hopp |
143428 |
+ :let l = range(8)
|
|
Karsten Hopp |
143428 |
+ :py3 l=vim.bindeval('l')
|
|
Karsten Hopp |
143428 |
+ :py3 l[6:2] = ()
|
|
Karsten Hopp |
143428 |
+ :$put =string(l)
|
|
Karsten Hopp |
143428 |
+ :let l = range(8)
|
|
Karsten Hopp |
143428 |
+ :py3 l=vim.bindeval('l')
|
|
Karsten Hopp |
143428 |
+ :py3 l[6:2:1] = ()
|
|
Karsten Hopp |
143428 |
+ :$put =string(l)
|
|
Karsten Hopp |
143428 |
+ :let l = range(8)
|
|
Karsten Hopp |
143428 |
+ :py3 l=vim.bindeval('l')
|
|
Karsten Hopp |
143428 |
+ :py3 l[2:2:1] = ()
|
|
Karsten Hopp |
143428 |
+ :$put =string(l)
|
|
Karsten Hopp |
143428 |
:"
|
|
Karsten Hopp |
143428 |
:" Locked variables
|
|
Karsten Hopp |
143428 |
:let l = [0, 1, 2, 3]
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 363,368 ****
|
|
Karsten Hopp |
143428 |
--- 395,432 ----
|
|
Karsten Hopp |
143428 |
:py3 del trace_main
|
|
Karsten Hopp |
143428 |
:$put =string(l)
|
|
Karsten Hopp |
143428 |
:"
|
|
Karsten Hopp |
143428 |
+ :" Slice
|
|
Karsten Hopp |
143428 |
+ :py3 ll = vim.bindeval('[0, 1, 2, 3, 4, 5]')
|
|
Karsten Hopp |
143428 |
+ :py3 l = ll[:4]
|
|
Karsten Hopp |
143428 |
+ :$put =string(py3eval('l'))
|
|
Karsten Hopp |
143428 |
+ :py3 l = ll[2:]
|
|
Karsten Hopp |
143428 |
+ :$put =string(py3eval('l'))
|
|
Karsten Hopp |
143428 |
+ :py3 l = ll[:-4]
|
|
Karsten Hopp |
143428 |
+ :$put =string(py3eval('l'))
|
|
Karsten Hopp |
143428 |
+ :py3 l = ll[-2:]
|
|
Karsten Hopp |
143428 |
+ :$put =string(py3eval('l'))
|
|
Karsten Hopp |
143428 |
+ :py3 l = ll[2:4]
|
|
Karsten Hopp |
143428 |
+ :$put =string(py3eval('l'))
|
|
Karsten Hopp |
143428 |
+ :py3 l = ll[4:2]
|
|
Karsten Hopp |
143428 |
+ :$put =string(py3eval('l'))
|
|
Karsten Hopp |
143428 |
+ :py3 l = ll[-4:-2]
|
|
Karsten Hopp |
143428 |
+ :$put =string(py3eval('l'))
|
|
Karsten Hopp |
143428 |
+ :py3 l = ll[-2:-4]
|
|
Karsten Hopp |
143428 |
+ :$put =string(py3eval('l'))
|
|
Karsten Hopp |
143428 |
+ :py3 l = ll[:]
|
|
Karsten Hopp |
143428 |
+ :$put =string(py3eval('l'))
|
|
Karsten Hopp |
143428 |
+ :py3 l = ll[0:6]
|
|
Karsten Hopp |
143428 |
+ :$put =string(py3eval('l'))
|
|
Karsten Hopp |
143428 |
+ :py3 l = ll[-10:10]
|
|
Karsten Hopp |
143428 |
+ :$put =string(py3eval('l'))
|
|
Karsten Hopp |
143428 |
+ :py3 l = ll[4:2:-1]
|
|
Karsten Hopp |
143428 |
+ :$put =string(py3eval('l'))
|
|
Karsten Hopp |
143428 |
+ :py3 l = ll[::2]
|
|
Karsten Hopp |
143428 |
+ :$put =string(py3eval('l'))
|
|
Karsten Hopp |
143428 |
+ :py3 l = ll[4:2:1]
|
|
Karsten Hopp |
143428 |
+ :$put =string(py3eval('l'))
|
|
Karsten Hopp |
143428 |
+ :py3 del l
|
|
Karsten Hopp |
143428 |
+ :"
|
|
Karsten Hopp |
143428 |
:" Vars
|
|
Karsten Hopp |
143428 |
:let g:foo = 'bac'
|
|
Karsten Hopp |
143428 |
:let w:abc3 = 'def'
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 859,864 ****
|
|
Karsten Hopp |
143428 |
--- 923,929 ----
|
|
Karsten Hopp |
143428 |
l = vim.List()
|
|
Karsten Hopp |
143428 |
ll = vim.List('abcE')
|
|
Karsten Hopp |
143428 |
ll.locked = True
|
|
Karsten Hopp |
143428 |
+ nel = vim.List('abcO')
|
|
Karsten Hopp |
143428 |
f = vim.Function('string')
|
|
Karsten Hopp |
143428 |
fd = vim.Function('F')
|
|
Karsten Hopp |
143428 |
fdel = vim.Function('D')
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 946,951 ****
|
|
Karsten Hopp |
143428 |
--- 1011,1030 ----
|
|
Karsten Hopp |
143428 |
def __next__(self):
|
|
Karsten Hopp |
143428 |
raise NotImplementedError('next')
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
+ class FailingIterNextN(object):
|
|
Karsten Hopp |
143428 |
+ def __init__(self, n):
|
|
Karsten Hopp |
143428 |
+ self.n = n
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
+ def __iter__(self):
|
|
Karsten Hopp |
143428 |
+ return self
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
+ def __next__(self):
|
|
Karsten Hopp |
143428 |
+ if self.n:
|
|
Karsten Hopp |
143428 |
+ self.n -= 1
|
|
Karsten Hopp |
143428 |
+ return 1
|
|
Karsten Hopp |
143428 |
+ else:
|
|
Karsten Hopp |
143428 |
+ raise NotImplementedError('next N')
|
|
Karsten Hopp |
143428 |
+
|
|
Karsten Hopp |
143428 |
class FailingMappingKey(object):
|
|
Karsten Hopp |
143428 |
def __getitem__(self, item):
|
|
Karsten Hopp |
143428 |
raise NotImplementedError('getitem:mappingkey')
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 1050,1055 ****
|
|
Karsten Hopp |
143428 |
--- 1129,1135 ----
|
|
Karsten Hopp |
143428 |
cb.append(">>> iter")
|
|
Karsten Hopp |
143428 |
ee('d.update(FailingMapping())')
|
|
Karsten Hopp |
143428 |
ee('d.update([FailingIterNext()])')
|
|
Karsten Hopp |
143428 |
+ ee('d.update([FailingIterNextN(1)])')
|
|
Karsten Hopp |
143428 |
iter_test('d.update(%s)')
|
|
Karsten Hopp |
143428 |
convertfrompyobject_test('d.update(%s)')
|
|
Karsten Hopp |
143428 |
stringtochars_test('d.update(((%s, 0),))')
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 1072,1077 ****
|
|
Karsten Hopp |
143428 |
--- 1152,1165 ----
|
|
Karsten Hopp |
143428 |
cb.append(">> ListAssSlice")
|
|
Karsten Hopp |
143428 |
ee('ll[1:100] = "abcJ"')
|
|
Karsten Hopp |
143428 |
iter_test('l[:] = %s')
|
|
Karsten Hopp |
143428 |
+ ee('nel[1:10:2] = "abcK"')
|
|
Karsten Hopp |
143428 |
+ cb.append(repr(tuple(nel)))
|
|
Karsten Hopp |
143428 |
+ ee('nel[1:10:2] = "a"')
|
|
Karsten Hopp |
143428 |
+ cb.append(repr(tuple(nel)))
|
|
Karsten Hopp |
143428 |
+ ee('nel[1:1:-1] = "a"')
|
|
Karsten Hopp |
143428 |
+ cb.append(repr(tuple(nel)))
|
|
Karsten Hopp |
143428 |
+ ee('nel[:] = FailingIterNextN(2)')
|
|
Karsten Hopp |
143428 |
+ cb.append(repr(tuple(nel)))
|
|
Karsten Hopp |
143428 |
convertfrompyobject_test('l[:] = [%s]')
|
|
Karsten Hopp |
143428 |
cb.append(">> ListConcatInPlace")
|
|
Karsten Hopp |
143428 |
iter_test('l.extend(%s)')
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 1153,1158 ****
|
|
Karsten Hopp |
143428 |
--- 1241,1247 ----
|
|
Karsten Hopp |
143428 |
del dl
|
|
Karsten Hopp |
143428 |
del l
|
|
Karsten Hopp |
143428 |
del ll
|
|
Karsten Hopp |
143428 |
+ del nel
|
|
Karsten Hopp |
143428 |
del f
|
|
Karsten Hopp |
143428 |
del fd
|
|
Karsten Hopp |
143428 |
del fdel
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 1166,1171 ****
|
|
Karsten Hopp |
143428 |
--- 1255,1261 ----
|
|
Karsten Hopp |
143428 |
del FailingTrue
|
|
Karsten Hopp |
143428 |
del FailingIter
|
|
Karsten Hopp |
143428 |
del FailingIterNext
|
|
Karsten Hopp |
143428 |
+ del FailingIterNextN
|
|
Karsten Hopp |
143428 |
del FailingMapping
|
|
Karsten Hopp |
143428 |
del FailingMappingKey
|
|
Karsten Hopp |
143428 |
del FailingList
|
|
Karsten Hopp |
143428 |
*** ../vim-7.4.150/src/testdir/test87.ok 2013-11-28 17:04:38.000000000 +0100
|
|
Karsten Hopp |
143428 |
--- src/testdir/test87.ok 2014-01-14 16:24:49.000000000 +0100
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 41,46 ****
|
|
Karsten Hopp |
143428 |
--- 41,49 ----
|
|
Karsten Hopp |
143428 |
[2, 3]
|
|
Karsten Hopp |
143428 |
[2, 3]
|
|
Karsten Hopp |
143428 |
[2, 3]
|
|
Karsten Hopp |
143428 |
+ [1, 3]
|
|
Karsten Hopp |
143428 |
+ [0, 2]
|
|
Karsten Hopp |
143428 |
+ [0, 1, 2, 3]
|
|
Karsten Hopp |
143428 |
['a', 0, 1, 2, 3]
|
|
Karsten Hopp |
143428 |
[0, 'b', 2, 3]
|
|
Karsten Hopp |
143428 |
[0, 1, 'c']
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 49,54 ****
|
|
Karsten Hopp |
143428 |
--- 52,62 ----
|
|
Karsten Hopp |
143428 |
['f', 2, 3]
|
|
Karsten Hopp |
143428 |
[0, 1, 'g', 2, 3]
|
|
Karsten Hopp |
143428 |
['h']
|
|
Karsten Hopp |
143428 |
+ [0, 1, 10, 3, 20, 5, 6, 7]
|
|
Karsten Hopp |
143428 |
+ [0, 1, 2, 3, 20, 5, 10, 7]
|
|
Karsten Hopp |
143428 |
+ [0, 1, 2, 3, 4, 5, 6, 7]
|
|
Karsten Hopp |
143428 |
+ [0, 1, 2, 3, 4, 5, 6, 7]
|
|
Karsten Hopp |
143428 |
+ [0, 1, 2, 3, 4, 5, 6, 7]
|
|
Karsten Hopp |
143428 |
[0, 1, 2, 3]
|
|
Karsten Hopp |
143428 |
[function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd']
|
|
Karsten Hopp |
143428 |
[function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd', 'DictNewStart', 1, 2, 3, 'DictNewEnd', {'a': 'b'}]
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 85,90 ****
|
|
Karsten Hopp |
143428 |
--- 93,112 ----
|
|
Karsten Hopp |
143428 |
vim: Vim(let):E859:
|
|
Karsten Hopp |
143428 |
[1]
|
|
Karsten Hopp |
143428 |
[1, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 1]
|
|
Karsten Hopp |
143428 |
+ [0, 1, 2, 3]
|
|
Karsten Hopp |
143428 |
+ [2, 3, 4, 5]
|
|
Karsten Hopp |
143428 |
+ [0, 1]
|
|
Karsten Hopp |
143428 |
+ [4, 5]
|
|
Karsten Hopp |
143428 |
+ [2, 3]
|
|
Karsten Hopp |
143428 |
+ []
|
|
Karsten Hopp |
143428 |
+ [2, 3]
|
|
Karsten Hopp |
143428 |
+ []
|
|
Karsten Hopp |
143428 |
+ [0, 1, 2, 3, 4, 5]
|
|
Karsten Hopp |
143428 |
+ [0, 1, 2, 3, 4, 5]
|
|
Karsten Hopp |
143428 |
+ [0, 1, 2, 3, 4, 5]
|
|
Karsten Hopp |
143428 |
+ [4, 3]
|
|
Karsten Hopp |
143428 |
+ [0, 2, 4]
|
|
Karsten Hopp |
143428 |
+ []
|
|
Karsten Hopp |
143428 |
Abc
|
|
Karsten Hopp |
143428 |
bac
|
|
Karsten Hopp |
143428 |
def
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 588,593 ****
|
|
Karsten Hopp |
143428 |
--- 610,616 ----
|
|
Karsten Hopp |
143428 |
>>> iter
|
|
Karsten Hopp |
143428 |
d.update(FailingMapping()):(<class 'NotImplementedError'>, NotImplementedError('keys',))
|
|
Karsten Hopp |
143428 |
d.update([FailingIterNext()]):(<class 'NotImplementedError'>, NotImplementedError('next',))
|
|
Karsten Hopp |
143428 |
+ d.update([FailingIterNextN(1)]):(<class 'NotImplementedError'>, NotImplementedError('next N',))
|
|
Karsten Hopp |
143428 |
>>> Testing *Iter* using d.update(%s)
|
|
Karsten Hopp |
143428 |
d.update(FailingIter()):(<class 'NotImplementedError'>, NotImplementedError('iter',))
|
|
Karsten Hopp |
143428 |
d.update(FailingIterNext()):(<class 'NotImplementedError'>, NotImplementedError('next',))
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 818,823 ****
|
|
Karsten Hopp |
143428 |
--- 841,854 ----
|
|
Karsten Hopp |
143428 |
l[:] = FailingIter():(<class 'NotImplementedError'>, NotImplementedError('iter',))
|
|
Karsten Hopp |
143428 |
l[:] = FailingIterNext():(<class 'NotImplementedError'>, NotImplementedError('next',))
|
|
Karsten Hopp |
143428 |
<<< Finished
|
|
Karsten Hopp |
143428 |
+ nel[1:10:2] = "abcK":(<class 'ValueError'>, ValueError('attempt to assign sequence of size greater then 2 to extended slice',))
|
|
Karsten Hopp |
143428 |
+ (b'a', b'b', b'c', b'O')
|
|
Karsten Hopp |
143428 |
+ nel[1:10:2] = "a":(<class 'ValueError'>, ValueError('attempt to assign sequence of size 1 to extended slice of size 2',))
|
|
Karsten Hopp |
143428 |
+ (b'a', b'b', b'c', b'O')
|
|
Karsten Hopp |
143428 |
+ nel[1:1:-1] = "a":(<class 'ValueError'>, ValueError('attempt to assign sequence of size greater then 0 to extended slice',))
|
|
Karsten Hopp |
143428 |
+ (b'a', b'b', b'c', b'O')
|
|
Karsten Hopp |
143428 |
+ nel[:] = FailingIterNextN(2):(<class 'NotImplementedError'>, NotImplementedError('next N',))
|
|
Karsten Hopp |
143428 |
+ (b'a', b'b', b'c', b'O')
|
|
Karsten Hopp |
143428 |
>>> Testing StringToChars using l[:] = [{%s : 1}]
|
|
Karsten Hopp |
143428 |
l[:] = [{1 : 1}]:(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',))
|
|
Karsten Hopp |
143428 |
l[:] = [{b"\0" : 1}]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
|
|
Karsten Hopp |
143428 |
*** ../vim-7.4.150/src/version.c 2014-01-14 15:53:47.000000000 +0100
|
|
Karsten Hopp |
143428 |
--- src/version.c 2014-01-14 16:27:01.000000000 +0100
|
|
Karsten Hopp |
143428 |
***************
|
|
Karsten Hopp |
143428 |
*** 740,741 ****
|
|
Karsten Hopp |
143428 |
--- 740,743 ----
|
|
Karsten Hopp |
143428 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
143428 |
+ /**/
|
|
Karsten Hopp |
143428 |
+ 151,
|
|
Karsten Hopp |
143428 |
/**/
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
--
|
|
Karsten Hopp |
143428 |
hundred-and-one symptoms of being an internet addict:
|
|
Karsten Hopp |
143428 |
159. You get excited whenever discussing your hard drive.
|
|
Karsten Hopp |
143428 |
|
|
Karsten Hopp |
143428 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
143428 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
143428 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
143428 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|