]> granicus.if.org Git - vim/commitdiff
updated for version 7.4.176 v7.4.176
authorBram Moolenaar <Bram@vim.org>
Tue, 11 Feb 2014 17:47:27 +0000 (18:47 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 11 Feb 2014 17:47:27 +0000 (18:47 +0100)
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)

src/if_py_both.h
src/testdir/test86.in
src/testdir/test87.in
src/version.c

index 7c205f8c4f1c9c7a141883ab463efe3e709ec613..9315324c46d08ada17744bc96e08ec2a9193c9b5 100644 (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
index 240e07e477d6ef9a48d7b10a286963ab22fb2a28..ab5541faf22775d73ac3f2f3cb4f5a30fb5a5a0a 100644 (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})
index e45883b59d9cb72771d347b748d7fcecfbc5c737..1515a906bbf52d74ad7c7c772f3e28db5b123ff0 100644 (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})
index 5fdb9242589407434ed8b834e7eb61fa35ab273a..a015595d105b6fdde591be251395e62b9ff6ea5f 100644 (file)
@@ -738,6 +738,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    176,
 /**/
     175,
 /**/