summaryrefslogtreecommitdiffstats
path: root/patches/source/vim/patches/7.4.176
blob: ccde6b682130537492dfd00d9e7b8533eb7e5951 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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


*** ../vim-7.4.175/src/if_py_both.h	2014-02-11 16:00:31.198157698 +0100
--- src/if_py_both.h	2014-02-11 18:41:12.774305435 +0100
***************
*** 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
*** ../vim-7.4.175/src/testdir/test86.in	2014-01-14 16:54:53.000000000 +0100
--- src/testdir/test86.in	2014-02-11 17:25:08.414235496 +0100
***************
*** 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})
*** ../vim-7.4.175/src/testdir/test87.in	2014-01-14 16:54:53.000000000 +0100
--- src/testdir/test87.in	2014-02-11 17:25:12.602235560 +0100
***************
*** 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})
*** ../vim-7.4.175/src/version.c	2014-02-11 17:05:57.282217857 +0100
--- src/version.c	2014-02-11 18:46:37.518310411 +0100
***************
*** 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    ///