| To: vim_dev@googlegroups.com |
| Subject: Patch 7.4.176 |
| Fcc: outbox |
| From: Bram Moolenaar <Bram@moolenaar.net> |
| Mime-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| |
| Patch 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) |
| Files: src/if_py_both.h, src/testdir/test86.in, src/testdir/test87.in |
| |
| |
| |
| |
| |
| *** 1918,1928 **** |
| } |
| else |
| { |
| ! PyObject *obj; |
| |
| ! if (!PyArg_ParseTuple(args, "O", &obj)) |
| return NULL; |
| |
| if (PyObject_HasAttrString(obj, "keys")) |
| return DictionaryUpdate(self, NULL, obj); |
| else |
| --- 1919,1935 ---- |
| } |
| else |
| { |
| ! 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 |
| |
| |
| |
| *** 39,44 **** |
| --- 39,45 ---- |
| 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}) |
| |
| |
| |
| *** 33,38 **** |
| --- 33,39 ---- |
| 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}) |
| |
| |
| |
| *** 740,741 **** |
| --- 740,743 ---- |
| { /* Add new patch number below this line */ |
| + /**/ |
| + 176, |
| /**/ |
| |
| -- |
| "Intelligence has much less practical application than you'd think." |
| -- Scott Adams, Dilbert. |
| |
| /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ |
| /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ |
| \\\ an exciting new programming language -- http://www.Zimbu.org /// |
| \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |