Skip to content

Commit

Permalink
updated for version 7.4.176
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
brammool committed Feb 11, 2014
1 parent 22cc197 commit 2c232e8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/if_py_both.h
Expand Up @@ -1918,11 +1918,17 @@ DictionaryUpdate(DictionaryObject *self, PyObject *args, PyObject *kwargs)
} }
else else
{ {
PyObject *obj; PyObject *obj = NULL;


if (!PyArg_ParseTuple(args, "O", &obj)) if (!PyArg_ParseTuple(args, "|O", &obj))
return NULL; return NULL;


if (obj == NULL)
{
Py_INCREF(Py_None);
return Py_None;
}

if (PyObject_HasAttrString(obj, "keys")) if (PyObject_HasAttrString(obj, "keys"))
return DictionaryUpdate(self, NULL, obj); return DictionaryUpdate(self, NULL, obj);
else else
Expand Down
1 change: 1 addition & 0 deletions src/testdir/test86.in
Expand Up @@ -39,6 +39,7 @@ STARTTEST
py << EOF py << EOF
d=vim.bindeval('d') d=vim.bindeval('d')
d['1']='asd' d['1']='asd'
d.update() # Must not do anything, including throwing errors
d.update(b=[1, 2, f]) d.update(b=[1, 2, f])
d.update((('-1', {'a': 1}),)) d.update((('-1', {'a': 1}),))
d.update({'0': -1}) d.update({'0': -1})
Expand Down
1 change: 1 addition & 0 deletions src/testdir/test87.in
Expand Up @@ -33,6 +33,7 @@ STARTTEST
py3 << EOF py3 << EOF
d=vim.bindeval('d') d=vim.bindeval('d')
d['1']='asd' d['1']='asd'
d.update() # Must not do anything, including throwing errors
d.update(b=[1, 2, f]) d.update(b=[1, 2, f])
d.update((('-1', {'a': 1}),)) d.update((('-1', {'a': 1}),))
d.update({'0': -1}) d.update({'0': -1})
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -738,6 +738,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 */
/**/
176,
/**/ /**/
175, 175,
/**/ /**/
Expand Down

0 comments on commit 2c232e8

Please sign in to comment.