home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.3 / 7.3.1096 < prev    next >
Encoding:
Internet Message Format  |  2013-06-01  |  10.3 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.3.1096
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.3.1096
  11. Problem:    Python: popitem() was not defined in a standard way.
  12. Solution:   Remove the argument from popitem(). (ZyX)
  13. Files:        runtime/doc/if_pyth.txt, src/if_py_both.h, src/testdir/test86.in,
  14.         src/testdir/test86.ok, src/testdir/test87.in,
  15.         src/testdir/test87.ok
  16.  
  17.  
  18. *** ../vim-7.3.1095/runtime/doc/if_pyth.txt    2013-05-30 13:32:26.000000000 +0200
  19. --- runtime/doc/if_pyth.txt    2013-06-02 17:39:35.000000000 +0200
  20. ***************
  21. *** 174,180 ****
  22.   vim.bindeval(str)                    *python-bindeval*
  23.       Like |python-eval|, but returns special objects described in 
  24.       |python-bindeval-objects|. These python objects let you modify (|List| 
  25. !     or |Dictionary|) or call (|Funcref|) vim objecs.
  26.   
  27.   Error object of the "vim" module
  28.   
  29. --- 174,180 ----
  30.   vim.bindeval(str)                    *python-bindeval*
  31.       Like |python-eval|, but returns special objects described in 
  32.       |python-bindeval-objects|. These python objects let you modify (|List| 
  33. !     or |Dictionary|) or call (|Funcref|) vim objects.
  34.   
  35.   Error object of the "vim" module
  36.   
  37. ***************
  38. *** 208,214 ****
  39.           :py w in vim.windows    # Membership test
  40.           :py n = len(vim.windows)    # Number of elements
  41.           :py for w in vim.windows:    # Sequential access
  42. ! <    Note: vim.windows object always accesses current tab page,. 
  43.       |python-tabpage|.windows objects are bound to parent |python-tabpage| 
  44.       object and always use windows from that tab page (or throw vim.error 
  45.       in case tab page was deleted). You can keep a reference to both 
  46. --- 208,214 ----
  47.           :py w in vim.windows    # Membership test
  48.           :py n = len(vim.windows)    # Number of elements
  49.           :py for w in vim.windows:    # Sequential access
  50. ! <    Note: vim.windows object always accesses current tab page. 
  51.       |python-tabpage|.windows objects are bound to parent |python-tabpage| 
  52.       object and always use windows from that tab page (or throw vim.error 
  53.       in case tab page was deleted). You can keep a reference to both 
  54. ***************
  55. *** 494,503 ****
  56.                       Remove specified key from dictionary and return 
  57.                       corresponding value. If key is not found and default is 
  58.                       given returns the default, otherwise raises KeyError.
  59. !         popitem(key)
  60. !                     Remove specified key from dictionary and return a pair 
  61. !                     with it and the corresponding value. Returned key is a new 
  62. !                     object.
  63.           has_key(key)
  64.                       Check whether dictionary contains specified key, similar 
  65.                       to `key in dict`.
  66. --- 494,502 ----
  67.                       Remove specified key from dictionary and return 
  68.                       corresponding value. If key is not found and default is 
  69.                       given returns the default, otherwise raises KeyError.
  70. !         popitem()
  71. !                     Remove random key from dictionary and return (key, value) 
  72. !                     pair.
  73.           has_key(key)
  74.                       Check whether dictionary contains specified key, similar 
  75.                       to `key in dict`.
  76. *** ../vim-7.3.1095/src/if_py_both.h    2013-05-31 20:49:27.000000000 +0200
  77. --- src/if_py_both.h    2013-06-02 17:39:35.000000000 +0200
  78. ***************
  79. *** 1061,1077 ****
  80.       dictitem_free(di);
  81.       }
  82.   
  83. -     if (flags & DICT_FLAG_RETURN_PAIR)
  84. -     {
  85. -     PyObject    *tmp = r;
  86. -     if (!(r = Py_BuildValue("(" Py_bytes_fmt "O)", hi->hi_key, tmp)))
  87. -     {
  88. -         Py_DECREF(tmp);
  89. -         return NULL;
  90. -     }
  91. -     }
  92.       return r;
  93.   }
  94.   
  95. --- 1061,1066 ----
  96. ***************
  97. *** 1457,1471 ****
  98.   }
  99.   
  100.       static PyObject *
  101. ! DictionaryPopItem(DictionaryObject *self, PyObject *args)
  102.   {
  103. !     PyObject    *keyObject;
  104.   
  105. !     if (!PyArg_ParseTuple(args, "O", &keyObject))
  106.       return NULL;
  107.   
  108. !     return _DictionaryItem(self, keyObject,
  109. !                 DICT_FLAG_POP|DICT_FLAG_RETURN_PAIR);
  110.   }
  111.   
  112.       static PyObject *
  113. --- 1446,1483 ----
  114.   }
  115.   
  116.       static PyObject *
  117. ! DictionaryPopItem(DictionaryObject *self)
  118.   {
  119. !     hashitem_T    *hi;
  120. !     PyObject    *r;
  121. !     PyObject    *valObject;
  122. !     dictitem_T    *di;
  123.   
  124. !     if (self->dict->dv_hashtab.ht_used == 0)
  125. !     {
  126. !     PyErr_SetNone(PyExc_KeyError);
  127. !     return NULL;
  128. !     }
  129. !     hi = self->dict->dv_hashtab.ht_array;
  130. !     while (HASHITEM_EMPTY(hi))
  131. !     ++hi;
  132. !     di = dict_lookup(hi);
  133. !     if (!(valObject = ConvertToPyObject(&di->di_tv)))
  134.       return NULL;
  135.   
  136. !     if (!(r = Py_BuildValue("(" Py_bytes_fmt "O)", hi->hi_key, valObject)))
  137. !     {
  138. !     Py_DECREF(valObject);
  139. !     return NULL;
  140. !     }
  141. !     hash_remove(&self->dict->dv_hashtab, hi);
  142. !     dictitem_free(di);
  143. !     return r;
  144.   }
  145.   
  146.       static PyObject *
  147. ***************
  148. *** 1505,1511 ****
  149.       {"update",    (PyCFunction)DictionaryUpdate,        METH_VARARGS|METH_KEYWORDS, ""},
  150.       {"get",    (PyCFunction)DictionaryGet,        METH_VARARGS,    ""},
  151.       {"pop",    (PyCFunction)DictionaryPop,        METH_VARARGS,    ""},
  152. !     {"popitem",    (PyCFunction)DictionaryPopItem,        METH_VARARGS,    ""},
  153.       {"has_key",    (PyCFunction)DictionaryHasKey,        METH_VARARGS,    ""},
  154.       {"__dir__",    (PyCFunction)DictionaryDir,        METH_NOARGS,    ""},
  155.       { NULL,    NULL,                    0,        NULL}
  156. --- 1517,1523 ----
  157.       {"update",    (PyCFunction)DictionaryUpdate,        METH_VARARGS|METH_KEYWORDS, ""},
  158.       {"get",    (PyCFunction)DictionaryGet,        METH_VARARGS,    ""},
  159.       {"pop",    (PyCFunction)DictionaryPop,        METH_VARARGS,    ""},
  160. !     {"popitem",    (PyCFunction)DictionaryPopItem,        METH_NOARGS,    ""},
  161.       {"has_key",    (PyCFunction)DictionaryHasKey,        METH_VARARGS,    ""},
  162.       {"__dir__",    (PyCFunction)DictionaryDir,        METH_NOARGS,    ""},
  163.       { NULL,    NULL,                    0,        NULL}
  164. *** ../vim-7.3.1095/src/testdir/test86.in    2013-06-01 20:32:09.000000000 +0200
  165. --- src/testdir/test86.in    2013-06-02 17:39:35.000000000 +0200
  166. ***************
  167. *** 83,89 ****
  168.   :$put =pyeval('repr(''1'' in d)')
  169.   :$put =pyeval('repr(list(iter(d)))')
  170.   :$put =string(d)
  171. ! :$put =pyeval('repr(d.popitem(''0''))')
  172.   :$put =pyeval('repr(d.get(''0''))')
  173.   :$put =pyeval('repr(list(iter(d)))')
  174.   :"
  175. --- 83,89 ----
  176.   :$put =pyeval('repr(''1'' in d)')
  177.   :$put =pyeval('repr(list(iter(d)))')
  178.   :$put =string(d)
  179. ! :$put =pyeval('repr(d.popitem())')
  180.   :$put =pyeval('repr(d.get(''0''))')
  181.   :$put =pyeval('repr(list(iter(d)))')
  182.   :"
  183. ***************
  184. *** 226,232 ****
  185.   em('d[u"a\\0b"]=1')
  186.   
  187.   em('d.pop("abc")')
  188. ! em('d.popitem("abc")')
  189.   EOF
  190.   :$put =messages
  191.   :unlet messages
  192. --- 226,232 ----
  193.   em('d[u"a\\0b"]=1')
  194.   
  195.   em('d.pop("abc")')
  196. ! em('d.popitem()')
  197.   EOF
  198.   :$put =messages
  199.   :unlet messages
  200. *** ../vim-7.3.1095/src/testdir/test86.ok    2013-06-01 20:32:09.000000000 +0200
  201. --- src/testdir/test86.ok    2013-06-02 17:39:35.000000000 +0200
  202. ***************
  203. *** 26,32 ****
  204.   False
  205.   ['0']
  206.   {'0': -1}
  207. ! ('', -1L)
  208.   None
  209.   []
  210.   [0, 1, 2, 3]
  211. --- 26,32 ----
  212.   False
  213.   ['0']
  214.   {'0': -1}
  215. ! ('0', -1L)
  216.   None
  217.   []
  218.   [0, 1, 2, 3]
  219. ***************
  220. *** 666,672 ****
  221.   d.update((("a", FailingMappingKey()),)):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
  222.   <<< Finished
  223.   >> DictionaryPopItem
  224. ! d.popitem(1, 2):(<type 'exceptions.TypeError'>, TypeError('function takes exactly 1 argument (2 given)',))
  225.   >> DictionaryHasKey
  226.   d.has_key():(<type 'exceptions.TypeError'>, TypeError('function takes exactly 1 argument (0 given)',))
  227.   > List
  228. --- 666,672 ----
  229.   d.update((("a", FailingMappingKey()),)):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
  230.   <<< Finished
  231.   >> DictionaryPopItem
  232. ! d.popitem(1, 2):(<type 'exceptions.TypeError'>, TypeError('popitem() takes no arguments (2 given)',))
  233.   >> DictionaryHasKey
  234.   d.has_key():(<type 'exceptions.TypeError'>, TypeError('function takes exactly 1 argument (0 given)',))
  235.   > List
  236. *** ../vim-7.3.1095/src/testdir/test87.in    2013-06-01 20:32:09.000000000 +0200
  237. --- src/testdir/test87.in    2013-06-02 17:39:35.000000000 +0200
  238. ***************
  239. *** 77,83 ****
  240.   :$put =py3eval('repr(''1'' in d)')
  241.   :$put =py3eval('repr(list(iter(d)))')
  242.   :$put =string(d)
  243. ! :$put =py3eval('repr(d.popitem(''0''))')
  244.   :$put =py3eval('repr(d.get(''0''))')
  245.   :$put =py3eval('repr(list(iter(d)))')
  246.   :"
  247. --- 77,83 ----
  248.   :$put =py3eval('repr(''1'' in d)')
  249.   :$put =py3eval('repr(list(iter(d)))')
  250.   :$put =string(d)
  251. ! :$put =py3eval('repr(d.popitem())')
  252.   :$put =py3eval('repr(d.get(''0''))')
  253.   :$put =py3eval('repr(list(iter(d)))')
  254.   :"
  255. ***************
  256. *** 220,226 ****
  257.   em('d[b"a\\0b"]=1')
  258.   
  259.   em('d.pop("abc")')
  260. ! em('d.popitem("abc")')
  261.   EOF
  262.   :$put =messages
  263.   :unlet messages
  264. --- 220,226 ----
  265.   em('d[b"a\\0b"]=1')
  266.   
  267.   em('d.pop("abc")')
  268. ! em('d.popitem()')
  269.   EOF
  270.   :$put =messages
  271.   :unlet messages
  272. *** ../vim-7.3.1095/src/testdir/test87.ok    2013-06-01 20:32:09.000000000 +0200
  273. --- src/testdir/test87.ok    2013-06-02 17:39:35.000000000 +0200
  274. ***************
  275. *** 26,32 ****
  276.   False
  277.   [b'0']
  278.   {'0': -1}
  279. ! (b'', -1)
  280.   None
  281.   []
  282.   [0, 1, 2, 3]
  283. --- 26,32 ----
  284.   False
  285.   [b'0']
  286.   {'0': -1}
  287. ! (b'0', -1)
  288.   None
  289.   []
  290.   [0, 1, 2, 3]
  291. ***************
  292. *** 663,669 ****
  293.   d.update((("a", FailingMappingKey()),)):(<class 'NotImplementedError'>, NotImplementedError())
  294.   <<< Finished
  295.   >> DictionaryPopItem
  296. ! d.popitem(1, 2):(<class 'TypeError'>, TypeError('function takes exactly 1 argument (2 given)',))
  297.   >> DictionaryHasKey
  298.   d.has_key():(<class 'TypeError'>, TypeError('function takes exactly 1 argument (0 given)',))
  299.   > List
  300. --- 663,669 ----
  301.   d.update((("a", FailingMappingKey()),)):(<class 'NotImplementedError'>, NotImplementedError())
  302.   <<< Finished
  303.   >> DictionaryPopItem
  304. ! d.popitem(1, 2):(<class 'TypeError'>, TypeError('popitem() takes no arguments (2 given)',))
  305.   >> DictionaryHasKey
  306.   d.has_key():(<class 'TypeError'>, TypeError('function takes exactly 1 argument (0 given)',))
  307.   > List
  308. *** ../vim-7.3.1095/src/version.c    2013-06-02 16:40:44.000000000 +0200
  309. --- src/version.c    2013-06-02 17:40:20.000000000 +0200
  310. ***************
  311. *** 730,731 ****
  312. --- 730,733 ----
  313.   {   /* Add new patch number below this line */
  314. + /**/
  315. +     1096,
  316.   /**/
  317.  
  318. -- 
  319. hundred-and-one symptoms of being an internet addict:
  320. 44. Your friends no longer send you e-mail...they just log on to your IRC
  321.     channel.
  322.  
  323.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  324. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  325. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  326.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  327.