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