073263
To: vim_dev@googlegroups.com
073263
Subject: Patch 7.4.176
073263
Fcc: outbox
073263
From: Bram Moolenaar <Bram@moolenaar.net>
073263
Mime-Version: 1.0
073263
Content-Type: text/plain; charset=UTF-8
073263
Content-Transfer-Encoding: 8bit
073263
------------
073263
073263
Patch 7.4.176
073263
Problem:    Dictionary.update() thows an error when used without arguments.
073263
	    Python programmers don't expect that.
073263
Solution:   Make Dictionary.update() without arguments do nothing. (ZyX)
073263
Files:	    src/if_py_both.h, src/testdir/test86.in, src/testdir/test87.in
073263
073263
073263
*** ../vim-7.4.175/src/if_py_both.h	2014-02-11 16:00:31.198157698 +0100
073263
--- src/if_py_both.h	2014-02-11 18:41:12.774305435 +0100
073263
***************
073263
*** 1918,1928 ****
073263
      }
073263
      else
073263
      {
073263
! 	PyObject	*obj;
073263
  
073263
! 	if (!PyArg_ParseTuple(args, "O", &obj))
073263
  	    return NULL;
073263
  
073263
  	if (PyObject_HasAttrString(obj, "keys"))
073263
  	    return DictionaryUpdate(self, NULL, obj);
073263
  	else
073263
--- 1919,1935 ----
073263
      }
073263
      else
073263
      {
073263
! 	PyObject	*obj = NULL;
073263
  
073263
! 	if (!PyArg_ParseTuple(args, "|O", &obj))
073263
  	    return NULL;
073263
  
073263
+ 	if (obj == NULL)
073263
+ 	{
073263
+ 	    Py_INCREF(Py_None);
073263
+ 	    return Py_None;
073263
+ 	}
073263
+ 
073263
  	if (PyObject_HasAttrString(obj, "keys"))
073263
  	    return DictionaryUpdate(self, NULL, obj);
073263
  	else
073263
*** ../vim-7.4.175/src/testdir/test86.in	2014-01-14 16:54:53.000000000 +0100
073263
--- src/testdir/test86.in	2014-02-11 17:25:08.414235496 +0100
073263
***************
073263
*** 39,44 ****
073263
--- 39,45 ----
073263
  py << EOF
073263
  d=vim.bindeval('d')
073263
  d['1']='asd'
073263
+ d.update()  # Must not do anything, including throwing errors
073263
  d.update(b=[1, 2, f])
073263
  d.update((('-1', {'a': 1}),))
073263
  d.update({'0': -1})
073263
*** ../vim-7.4.175/src/testdir/test87.in	2014-01-14 16:54:53.000000000 +0100
073263
--- src/testdir/test87.in	2014-02-11 17:25:12.602235560 +0100
073263
***************
073263
*** 33,38 ****
073263
--- 33,39 ----
073263
  py3 << EOF
073263
  d=vim.bindeval('d')
073263
  d['1']='asd'
073263
+ d.update()  # Must not do anything, including throwing errors
073263
  d.update(b=[1, 2, f])
073263
  d.update((('-1', {'a': 1}),))
073263
  d.update({'0': -1})
073263
*** ../vim-7.4.175/src/version.c	2014-02-11 17:05:57.282217857 +0100
073263
--- src/version.c	2014-02-11 18:46:37.518310411 +0100
073263
***************
073263
*** 740,741 ****
073263
--- 740,743 ----
073263
  {   /* Add new patch number below this line */
073263
+ /**/
073263
+     176,
073263
  /**/
073263
073263
-- 
073263
"Intelligence has much less practical application than you'd think."
073263
		  -- Scott Adams, Dilbert.
073263
073263
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
073263
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
073263
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
073263
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///