Mercurial > vim
diff src/if_py_both.h @ 5659:ae228baaec2c v7.4.176
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)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Tue, 11 Feb 2014 18:47:27 +0100 |
parents | f2c8d86c460d |
children | d1c8c1d64034 |
line wrap: on
line diff
--- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -1918,11 +1918,17 @@ DictionaryUpdate(DictionaryObject *self, } else { - PyObject *obj; - - if (!PyArg_ParseTuple(args, "O", &obj)) + PyObject *obj = NULL; + + 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