0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

updated for version 7.4.176

Problem:    Dictionary.update() thows an error when used without arguments.
            Python programmers don't expect that.
Solution:   Make Dictionary.update() without arguments do nothing. (ZyX)
This commit is contained in:
Bram Moolenaar
2014-02-11 18:47:27 +01:00
parent cd981f2e0f
commit 2d5f38ff10
4 changed files with 12 additions and 2 deletions

View File

@@ -1918,11 +1918,17 @@ DictionaryUpdate(DictionaryObject *self, PyObject *args, PyObject *kwargs)
}
else
{
PyObject *obj;
PyObject *obj = NULL;
if (!PyArg_ParseTuple(args, "O", &obj))
if (!PyArg_ParseTuple(args, "|O", &obj))
return NULL;
if (obj == NULL)
{
Py_INCREF(Py_None);
return Py_None;
}
if (PyObject_HasAttrString(obj, "keys"))
return DictionaryUpdate(self, NULL, obj);
else

View File

@@ -39,6 +39,7 @@ STARTTEST
py << EOF
d=vim.bindeval('d')
d['1']='asd'
d.update() # Must not do anything, including throwing errors
d.update(b=[1, 2, f])
d.update((('-1', {'a': 1}),))
d.update({'0': -1})

View File

@@ -33,6 +33,7 @@ STARTTEST
py3 << EOF
d=vim.bindeval('d')
d['1']='asd'
d.update() # Must not do anything, including throwing errors
d.update(b=[1, 2, f])
d.update((('-1', {'a': 1}),))
d.update({'0': -1})

View File

@@ -738,6 +738,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
176,
/**/
175,
/**/