diff options
author | Bram Moolenaar <Bram@vim.org> | 2014-02-11 18:47:27 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2014-02-11 18:47:27 +0100 |
commit | 2d5f38ff10a955058416b93aae774aeef1c34486 (patch) | |
tree | c95e374689c7f39926ab20a260eac144e389d727 /src/if_py_both.h | |
parent | cd981f2e0f00613a63b46e1e6b5227d5993ba994 (diff) |
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/if_py_both.h')
-rw-r--r-- | src/if_py_both.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/if_py_both.h b/src/if_py_both.h index 7c205f8c4f..9315324c46 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 |