Skip to content

Commit 2c232e8

Browse files
committed
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)
1 parent 22cc197 commit 2c232e8

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

src/if_py_both.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1918,11 +1918,17 @@ DictionaryUpdate(DictionaryObject *self, PyObject *args, PyObject *kwargs)
19181918
}
19191919
else
19201920
{
1921-
PyObject *obj;
1921+
PyObject *obj = NULL;
19221922

1923-
if (!PyArg_ParseTuple(args, "O", &obj))
1923+
if (!PyArg_ParseTuple(args, "|O", &obj))
19241924
return NULL;
19251925

1926+
if (obj == NULL)
1927+
{
1928+
Py_INCREF(Py_None);
1929+
return Py_None;
1930+
}
1931+
19261932
if (PyObject_HasAttrString(obj, "keys"))
19271933
return DictionaryUpdate(self, NULL, obj);
19281934
else

src/testdir/test86.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ STARTTEST
3939
py << EOF
4040
d=vim.bindeval('d')
4141
d['1']='asd'
42+
d.update() # Must not do anything, including throwing errors
4243
d.update(b=[1, 2, f])
4344
d.update((('-1', {'a': 1}),))
4445
d.update({'0': -1})

src/testdir/test87.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ STARTTEST
3333
py3 << EOF
3434
d=vim.bindeval('d')
3535
d['1']='asd'
36+
d.update() # Must not do anything, including throwing errors
3637
d.update(b=[1, 2, f])
3738
d.update((('-1', {'a': 1}),))
3839
d.update({'0': -1})

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,8 @@ static char *(features[]) =
738738

739739
static int included_patches[] =
740740
{ /* Add new patch number below this line */
741+
/**/
742+
176,
741743
/**/
742744
175,
743745
/**/

0 commit comments

Comments
 (0)