summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2014-02-11 18:47:27 +0100
committerBram Moolenaar <Bram@vim.org>2014-02-11 18:47:27 +0100
commit2d5f38ff10a955058416b93aae774aeef1c34486 (patch)
treec95e374689c7f39926ab20a260eac144e389d727 /src
parentcd981f2e0f00613a63b46e1e6b5227d5993ba994 (diff)
downloadvim-git-2d5f38ff10a955058416b93aae774aeef1c34486.tar.gz
updated for version 7.4.176v7.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)
Diffstat (limited to 'src')
-rw-r--r--src/if_py_both.h10
-rw-r--r--src/testdir/test86.in1
-rw-r--r--src/testdir/test87.in1
-rw-r--r--src/version.c2
4 files changed, 12 insertions, 2 deletions
diff --git a/src/if_py_both.h b/src/if_py_both.h
index 7c205f8c4..9315324c4 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -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
diff --git a/src/testdir/test86.in b/src/testdir/test86.in
index 240e07e47..ab5541faf 100644
--- a/src/testdir/test86.in
+++ b/src/testdir/test86.in
@@ -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})
diff --git a/src/testdir/test87.in b/src/testdir/test87.in
index e45883b59..1515a906b 100644
--- a/src/testdir/test87.in
+++ b/src/testdir/test87.in
@@ -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})
diff --git a/src/version.c b/src/version.c
index 5fdb92425..a015595d1 100644
--- a/src/version.c
+++ b/src/version.c
@@ -739,6 +739,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 176,
+/**/
175,
/**/
174,