mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
updated for version 7.3.1096
Problem: Python: popitem() was not defined in a standard way. Solution: Remove the argument from popitem(). (ZyX)
This commit is contained in:
@@ -174,7 +174,7 @@ vim.eval(str) *python-eval*
|
|||||||
vim.bindeval(str) *python-bindeval*
|
vim.bindeval(str) *python-bindeval*
|
||||||
Like |python-eval|, but returns special objects described in
|
Like |python-eval|, but returns special objects described in
|
||||||
|python-bindeval-objects|. These python objects let you modify (|List|
|
|python-bindeval-objects|. These python objects let you modify (|List|
|
||||||
or |Dictionary|) or call (|Funcref|) vim objecs.
|
or |Dictionary|) or call (|Funcref|) vim objects.
|
||||||
|
|
||||||
Error object of the "vim" module
|
Error object of the "vim" module
|
||||||
|
|
||||||
@@ -208,7 +208,7 @@ vim.windows *python-windows*
|
|||||||
:py w in vim.windows # Membership test
|
:py w in vim.windows # Membership test
|
||||||
:py n = len(vim.windows) # Number of elements
|
:py n = len(vim.windows) # Number of elements
|
||||||
:py for w in vim.windows: # Sequential access
|
:py for w in vim.windows: # Sequential access
|
||||||
< Note: vim.windows object always accesses current tab page,.
|
< Note: vim.windows object always accesses current tab page.
|
||||||
|python-tabpage|.windows objects are bound to parent |python-tabpage|
|
|python-tabpage|.windows objects are bound to parent |python-tabpage|
|
||||||
object and always use windows from that tab page (or throw vim.error
|
object and always use windows from that tab page (or throw vim.error
|
||||||
in case tab page was deleted). You can keep a reference to both
|
in case tab page was deleted). You can keep a reference to both
|
||||||
@@ -494,10 +494,9 @@ vim.Dictionary object *python-Dictionary*
|
|||||||
Remove specified key from dictionary and return
|
Remove specified key from dictionary and return
|
||||||
corresponding value. If key is not found and default is
|
corresponding value. If key is not found and default is
|
||||||
given returns the default, otherwise raises KeyError.
|
given returns the default, otherwise raises KeyError.
|
||||||
popitem(key)
|
popitem()
|
||||||
Remove specified key from dictionary and return a pair
|
Remove random key from dictionary and return (key, value)
|
||||||
with it and the corresponding value. Returned key is a new
|
pair.
|
||||||
object.
|
|
||||||
has_key(key)
|
has_key(key)
|
||||||
Check whether dictionary contains specified key, similar
|
Check whether dictionary contains specified key, similar
|
||||||
to `key in dict`.
|
to `key in dict`.
|
||||||
|
@@ -1061,17 +1061,6 @@ _DictionaryItem(DictionaryObject *self, PyObject *args, int flags)
|
|||||||
dictitem_free(di);
|
dictitem_free(di);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & DICT_FLAG_RETURN_PAIR)
|
|
||||||
{
|
|
||||||
PyObject *tmp = r;
|
|
||||||
|
|
||||||
if (!(r = Py_BuildValue("(" Py_bytes_fmt "O)", hi->hi_key, tmp)))
|
|
||||||
{
|
|
||||||
Py_DECREF(tmp);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1457,15 +1446,38 @@ DictionaryPop(DictionaryObject *self, PyObject *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
DictionaryPopItem(DictionaryObject *self, PyObject *args)
|
DictionaryPopItem(DictionaryObject *self)
|
||||||
{
|
{
|
||||||
PyObject *keyObject;
|
hashitem_T *hi;
|
||||||
|
PyObject *r;
|
||||||
|
PyObject *valObject;
|
||||||
|
dictitem_T *di;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O", &keyObject))
|
if (self->dict->dv_hashtab.ht_used == 0)
|
||||||
|
{
|
||||||
|
PyErr_SetNone(PyExc_KeyError);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
hi = self->dict->dv_hashtab.ht_array;
|
||||||
|
while (HASHITEM_EMPTY(hi))
|
||||||
|
++hi;
|
||||||
|
|
||||||
|
di = dict_lookup(hi);
|
||||||
|
|
||||||
|
if (!(valObject = ConvertToPyObject(&di->di_tv)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return _DictionaryItem(self, keyObject,
|
if (!(r = Py_BuildValue("(" Py_bytes_fmt "O)", hi->hi_key, valObject)))
|
||||||
DICT_FLAG_POP|DICT_FLAG_RETURN_PAIR);
|
{
|
||||||
|
Py_DECREF(valObject);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
hash_remove(&self->dict->dv_hashtab, hi);
|
||||||
|
dictitem_free(di);
|
||||||
|
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
@@ -1505,7 +1517,7 @@ static struct PyMethodDef DictionaryMethods[] = {
|
|||||||
{"update", (PyCFunction)DictionaryUpdate, METH_VARARGS|METH_KEYWORDS, ""},
|
{"update", (PyCFunction)DictionaryUpdate, METH_VARARGS|METH_KEYWORDS, ""},
|
||||||
{"get", (PyCFunction)DictionaryGet, METH_VARARGS, ""},
|
{"get", (PyCFunction)DictionaryGet, METH_VARARGS, ""},
|
||||||
{"pop", (PyCFunction)DictionaryPop, METH_VARARGS, ""},
|
{"pop", (PyCFunction)DictionaryPop, METH_VARARGS, ""},
|
||||||
{"popitem", (PyCFunction)DictionaryPopItem, METH_VARARGS, ""},
|
{"popitem", (PyCFunction)DictionaryPopItem, METH_NOARGS, ""},
|
||||||
{"has_key", (PyCFunction)DictionaryHasKey, METH_VARARGS, ""},
|
{"has_key", (PyCFunction)DictionaryHasKey, METH_VARARGS, ""},
|
||||||
{"__dir__", (PyCFunction)DictionaryDir, METH_NOARGS, ""},
|
{"__dir__", (PyCFunction)DictionaryDir, METH_NOARGS, ""},
|
||||||
{ NULL, NULL, 0, NULL}
|
{ NULL, NULL, 0, NULL}
|
||||||
|
@@ -83,7 +83,7 @@ EOF
|
|||||||
:$put =pyeval('repr(''1'' in d)')
|
:$put =pyeval('repr(''1'' in d)')
|
||||||
:$put =pyeval('repr(list(iter(d)))')
|
:$put =pyeval('repr(list(iter(d)))')
|
||||||
:$put =string(d)
|
:$put =string(d)
|
||||||
:$put =pyeval('repr(d.popitem(''0''))')
|
:$put =pyeval('repr(d.popitem())')
|
||||||
:$put =pyeval('repr(d.get(''0''))')
|
:$put =pyeval('repr(d.get(''0''))')
|
||||||
:$put =pyeval('repr(list(iter(d)))')
|
:$put =pyeval('repr(list(iter(d)))')
|
||||||
:"
|
:"
|
||||||
@@ -226,7 +226,7 @@ em('d["a\\0b"]=1')
|
|||||||
em('d[u"a\\0b"]=1')
|
em('d[u"a\\0b"]=1')
|
||||||
|
|
||||||
em('d.pop("abc")')
|
em('d.pop("abc")')
|
||||||
em('d.popitem("abc")')
|
em('d.popitem()')
|
||||||
EOF
|
EOF
|
||||||
:$put =messages
|
:$put =messages
|
||||||
:unlet messages
|
:unlet messages
|
||||||
|
@@ -26,7 +26,7 @@ True
|
|||||||
False
|
False
|
||||||
['0']
|
['0']
|
||||||
{'0': -1}
|
{'0': -1}
|
||||||
('', -1L)
|
('0', -1L)
|
||||||
None
|
None
|
||||||
[]
|
[]
|
||||||
[0, 1, 2, 3]
|
[0, 1, 2, 3]
|
||||||
@@ -666,7 +666,7 @@ d.update((("a", FailingMapping()),)):(<type 'exceptions.NotImplementedError'>, N
|
|||||||
d.update((("a", FailingMappingKey()),)):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
|
d.update((("a", FailingMappingKey()),)):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
|
||||||
<<< Finished
|
<<< Finished
|
||||||
>> DictionaryPopItem
|
>> DictionaryPopItem
|
||||||
d.popitem(1, 2):(<type 'exceptions.TypeError'>, TypeError('function takes exactly 1 argument (2 given)',))
|
d.popitem(1, 2):(<type 'exceptions.TypeError'>, TypeError('popitem() takes no arguments (2 given)',))
|
||||||
>> DictionaryHasKey
|
>> DictionaryHasKey
|
||||||
d.has_key():(<type 'exceptions.TypeError'>, TypeError('function takes exactly 1 argument (0 given)',))
|
d.has_key():(<type 'exceptions.TypeError'>, TypeError('function takes exactly 1 argument (0 given)',))
|
||||||
> List
|
> List
|
||||||
|
@@ -77,7 +77,7 @@ EOF
|
|||||||
:$put =py3eval('repr(''1'' in d)')
|
:$put =py3eval('repr(''1'' in d)')
|
||||||
:$put =py3eval('repr(list(iter(d)))')
|
:$put =py3eval('repr(list(iter(d)))')
|
||||||
:$put =string(d)
|
:$put =string(d)
|
||||||
:$put =py3eval('repr(d.popitem(''0''))')
|
:$put =py3eval('repr(d.popitem())')
|
||||||
:$put =py3eval('repr(d.get(''0''))')
|
:$put =py3eval('repr(d.get(''0''))')
|
||||||
:$put =py3eval('repr(list(iter(d)))')
|
:$put =py3eval('repr(list(iter(d)))')
|
||||||
:"
|
:"
|
||||||
@@ -220,7 +220,7 @@ em('d["a\\0b"]=1')
|
|||||||
em('d[b"a\\0b"]=1')
|
em('d[b"a\\0b"]=1')
|
||||||
|
|
||||||
em('d.pop("abc")')
|
em('d.pop("abc")')
|
||||||
em('d.popitem("abc")')
|
em('d.popitem()')
|
||||||
EOF
|
EOF
|
||||||
:$put =messages
|
:$put =messages
|
||||||
:unlet messages
|
:unlet messages
|
||||||
|
@@ -26,7 +26,7 @@ True
|
|||||||
False
|
False
|
||||||
[b'0']
|
[b'0']
|
||||||
{'0': -1}
|
{'0': -1}
|
||||||
(b'', -1)
|
(b'0', -1)
|
||||||
None
|
None
|
||||||
[]
|
[]
|
||||||
[0, 1, 2, 3]
|
[0, 1, 2, 3]
|
||||||
@@ -663,7 +663,7 @@ d.update((("a", FailingMapping()),)):(<class 'NotImplementedError'>, NotImplemen
|
|||||||
d.update((("a", FailingMappingKey()),)):(<class 'NotImplementedError'>, NotImplementedError())
|
d.update((("a", FailingMappingKey()),)):(<class 'NotImplementedError'>, NotImplementedError())
|
||||||
<<< Finished
|
<<< Finished
|
||||||
>> DictionaryPopItem
|
>> DictionaryPopItem
|
||||||
d.popitem(1, 2):(<class 'TypeError'>, TypeError('function takes exactly 1 argument (2 given)',))
|
d.popitem(1, 2):(<class 'TypeError'>, TypeError('popitem() takes no arguments (2 given)',))
|
||||||
>> DictionaryHasKey
|
>> DictionaryHasKey
|
||||||
d.has_key():(<class 'TypeError'>, TypeError('function takes exactly 1 argument (0 given)',))
|
d.has_key():(<class 'TypeError'>, TypeError('function takes exactly 1 argument (0 given)',))
|
||||||
> List
|
> List
|
||||||
|
@@ -728,6 +728,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1096,
|
||||||
/**/
|
/**/
|
||||||
1095,
|
1095,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user