|
Karsten Hopp |
85e644 |
To: vim-dev@vim.org
|
|
Karsten Hopp |
85e644 |
Subject: Patch 7.2.084
|
|
Karsten Hopp |
85e644 |
Fcc: outbox
|
|
Karsten Hopp |
85e644 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
85e644 |
Mime-Version: 1.0
|
|
Karsten Hopp |
85e644 |
Content-Type: text/plain; charset=ISO-8859-1
|
|
Karsten Hopp |
85e644 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
85e644 |
------------
|
|
Karsten Hopp |
85e644 |
|
|
Karsten Hopp |
85e644 |
Patch 7.2.084
|
|
Karsten Hopp |
85e644 |
Problem: Recursive structures are not handled properly in Python
|
|
Karsten Hopp |
85e644 |
vim.eval().
|
|
Karsten Hopp |
85e644 |
Solution: Keep track of references in a better way. (Yukihiro Nakadaira)
|
|
Karsten Hopp |
85e644 |
Files: src/if_python.c
|
|
Karsten Hopp |
85e644 |
|
|
Karsten Hopp |
85e644 |
|
|
Karsten Hopp |
85e644 |
*** ../vim-7.2.083/src/if_python.c Thu Nov 20 11:04:01 2008
|
|
Karsten Hopp |
85e644 |
--- src/if_python.c Tue Jan 13 18:08:06 2009
|
|
Karsten Hopp |
85e644 |
***************
|
|
Karsten Hopp |
85e644 |
*** 1151,1164 ****
|
|
Karsten Hopp |
85e644 |
|
|
Karsten Hopp |
85e644 |
/* Check if we run into a recursive loop. The item must be in lookupDict
|
|
Karsten Hopp |
85e644 |
* then and we can use it again. */
|
|
Karsten Hopp |
85e644 |
! sprintf(ptrBuf, PRINTF_DECIMAL_LONG_U, (long_u)our_tv);
|
|
Karsten Hopp |
85e644 |
! result = PyDict_GetItemString(lookupDict, ptrBuf);
|
|
Karsten Hopp |
85e644 |
! if (result != NULL)
|
|
Karsten Hopp |
85e644 |
! Py_INCREF(result);
|
|
Karsten Hopp |
85e644 |
! else if (our_tv->v_type == VAR_STRING)
|
|
Karsten Hopp |
85e644 |
{
|
|
Karsten Hopp |
85e644 |
result = Py_BuildValue("s", our_tv->vval.v_string);
|
|
Karsten Hopp |
85e644 |
- PyDict_SetItemString(lookupDict, ptrBuf, result);
|
|
Karsten Hopp |
85e644 |
}
|
|
Karsten Hopp |
85e644 |
else if (our_tv->v_type == VAR_NUMBER)
|
|
Karsten Hopp |
85e644 |
{
|
|
Karsten Hopp |
85e644 |
--- 1151,1173 ----
|
|
Karsten Hopp |
85e644 |
|
|
Karsten Hopp |
85e644 |
/* Check if we run into a recursive loop. The item must be in lookupDict
|
|
Karsten Hopp |
85e644 |
* then and we can use it again. */
|
|
Karsten Hopp |
85e644 |
! if ((our_tv->v_type == VAR_LIST && our_tv->vval.v_list != NULL)
|
|
Karsten Hopp |
85e644 |
! || (our_tv->v_type == VAR_DICT && our_tv->vval.v_dict != NULL))
|
|
Karsten Hopp |
85e644 |
! {
|
|
Karsten Hopp |
85e644 |
! sprintf(ptrBuf, PRINTF_DECIMAL_LONG_U,
|
|
Karsten Hopp |
85e644 |
! our_tv->v_type == VAR_LIST ? (long_u)our_tv->vval.v_list
|
|
Karsten Hopp |
85e644 |
! : (long_u)our_tv->vval.v_dict);
|
|
Karsten Hopp |
85e644 |
! result = PyDict_GetItemString(lookupDict, ptrBuf);
|
|
Karsten Hopp |
85e644 |
! if (result != NULL)
|
|
Karsten Hopp |
85e644 |
! {
|
|
Karsten Hopp |
85e644 |
! Py_INCREF(result);
|
|
Karsten Hopp |
85e644 |
! return result;
|
|
Karsten Hopp |
85e644 |
! }
|
|
Karsten Hopp |
85e644 |
! }
|
|
Karsten Hopp |
85e644 |
!
|
|
Karsten Hopp |
85e644 |
! if (our_tv->v_type == VAR_STRING)
|
|
Karsten Hopp |
85e644 |
{
|
|
Karsten Hopp |
85e644 |
result = Py_BuildValue("s", our_tv->vval.v_string);
|
|
Karsten Hopp |
85e644 |
}
|
|
Karsten Hopp |
85e644 |
else if (our_tv->v_type == VAR_NUMBER)
|
|
Karsten Hopp |
85e644 |
{
|
|
Karsten Hopp |
85e644 |
***************
|
|
Karsten Hopp |
85e644 |
*** 1167,1173 ****
|
|
Karsten Hopp |
85e644 |
/* For backwards compatibility numbers are stored as strings. */
|
|
Karsten Hopp |
85e644 |
sprintf(buf, "%ld", (long)our_tv->vval.v_number);
|
|
Karsten Hopp |
85e644 |
result = Py_BuildValue("s", buf);
|
|
Karsten Hopp |
85e644 |
- PyDict_SetItemString(lookupDict, ptrBuf, result);
|
|
Karsten Hopp |
85e644 |
}
|
|
Karsten Hopp |
85e644 |
# ifdef FEAT_FLOAT
|
|
Karsten Hopp |
85e644 |
else if (our_tv->v_type == VAR_FLOAT)
|
|
Karsten Hopp |
85e644 |
--- 1176,1181 ----
|
|
Karsten Hopp |
85e644 |
***************
|
|
Karsten Hopp |
85e644 |
*** 1176,1182 ****
|
|
Karsten Hopp |
85e644 |
|
|
Karsten Hopp |
85e644 |
sprintf(buf, "%f", our_tv->vval.v_float);
|
|
Karsten Hopp |
85e644 |
result = Py_BuildValue("s", buf);
|
|
Karsten Hopp |
85e644 |
- PyDict_SetItemString(lookupDict, ptrBuf, result);
|
|
Karsten Hopp |
85e644 |
}
|
|
Karsten Hopp |
85e644 |
# endif
|
|
Karsten Hopp |
85e644 |
else if (our_tv->v_type == VAR_LIST)
|
|
Karsten Hopp |
85e644 |
--- 1184,1189 ----
|
|
Karsten Hopp |
85e644 |
***************
|
|
Karsten Hopp |
85e644 |
*** 1185,1194 ****
|
|
Karsten Hopp |
85e644 |
listitem_T *curr;
|
|
Karsten Hopp |
85e644 |
|
|
Karsten Hopp |
85e644 |
result = PyList_New(0);
|
|
Karsten Hopp |
85e644 |
- PyDict_SetItemString(lookupDict, ptrBuf, result);
|
|
Karsten Hopp |
85e644 |
|
|
Karsten Hopp |
85e644 |
if (list != NULL)
|
|
Karsten Hopp |
85e644 |
{
|
|
Karsten Hopp |
85e644 |
for (curr = list->lv_first; curr != NULL; curr = curr->li_next)
|
|
Karsten Hopp |
85e644 |
{
|
|
Karsten Hopp |
85e644 |
newObj = VimToPython(&curr->li_tv, depth + 1, lookupDict);
|
|
Karsten Hopp |
85e644 |
--- 1192,1202 ----
|
|
Karsten Hopp |
85e644 |
listitem_T *curr;
|
|
Karsten Hopp |
85e644 |
|
|
Karsten Hopp |
85e644 |
result = PyList_New(0);
|
|
Karsten Hopp |
85e644 |
|
|
Karsten Hopp |
85e644 |
if (list != NULL)
|
|
Karsten Hopp |
85e644 |
{
|
|
Karsten Hopp |
85e644 |
+ PyDict_SetItemString(lookupDict, ptrBuf, result);
|
|
Karsten Hopp |
85e644 |
+
|
|
Karsten Hopp |
85e644 |
for (curr = list->lv_first; curr != NULL; curr = curr->li_next)
|
|
Karsten Hopp |
85e644 |
{
|
|
Karsten Hopp |
85e644 |
newObj = VimToPython(&curr->li_tv, depth + 1, lookupDict);
|
|
Karsten Hopp |
85e644 |
***************
|
|
Karsten Hopp |
85e644 |
*** 1200,1206 ****
|
|
Karsten Hopp |
85e644 |
else if (our_tv->v_type == VAR_DICT)
|
|
Karsten Hopp |
85e644 |
{
|
|
Karsten Hopp |
85e644 |
result = PyDict_New();
|
|
Karsten Hopp |
85e644 |
- PyDict_SetItemString(lookupDict, ptrBuf, result);
|
|
Karsten Hopp |
85e644 |
|
|
Karsten Hopp |
85e644 |
if (our_tv->vval.v_dict != NULL)
|
|
Karsten Hopp |
85e644 |
{
|
|
Karsten Hopp |
85e644 |
--- 1208,1213 ----
|
|
Karsten Hopp |
85e644 |
***************
|
|
Karsten Hopp |
85e644 |
*** 1209,1214 ****
|
|
Karsten Hopp |
85e644 |
--- 1216,1223 ----
|
|
Karsten Hopp |
85e644 |
hashitem_T *hi;
|
|
Karsten Hopp |
85e644 |
dictitem_T *di;
|
|
Karsten Hopp |
85e644 |
|
|
Karsten Hopp |
85e644 |
+ PyDict_SetItemString(lookupDict, ptrBuf, result);
|
|
Karsten Hopp |
85e644 |
+
|
|
Karsten Hopp |
85e644 |
for (hi = ht->ht_array; todo > 0; ++hi)
|
|
Karsten Hopp |
85e644 |
{
|
|
Karsten Hopp |
85e644 |
if (!HASHITEM_EMPTY(hi))
|
|
Karsten Hopp |
85e644 |
*** ../vim-7.2.083/src/version.c Tue Jan 13 17:27:18 2009
|
|
Karsten Hopp |
85e644 |
--- src/version.c Tue Jan 13 17:54:14 2009
|
|
Karsten Hopp |
85e644 |
***************
|
|
Karsten Hopp |
85e644 |
*** 678,679 ****
|
|
Karsten Hopp |
85e644 |
--- 678,681 ----
|
|
Karsten Hopp |
85e644 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
85e644 |
+ /**/
|
|
Karsten Hopp |
85e644 |
+ 84,
|
|
Karsten Hopp |
85e644 |
/**/
|
|
Karsten Hopp |
85e644 |
|
|
Karsten Hopp |
85e644 |
--
|
|
Karsten Hopp |
85e644 |
Article in the first Free Software Magazine: "Bram Moolenaar studied electrical
|
|
Karsten Hopp |
85e644 |
engineering at the Technical University of Delft and graduated in 1985 on a
|
|
Karsten Hopp |
85e644 |
multi-processor Unix architecture."
|
|
Karsten Hopp |
85e644 |
Response by "dimator": Could the school not afford a proper stage for the
|
|
Karsten Hopp |
85e644 |
ceremony?
|
|
Karsten Hopp |
85e644 |
|
|
Karsten Hopp |
85e644 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
85e644 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
85e644 |
\\\ download, build and distribute -- http://www.A-A-P.org ///
|
|
Karsten Hopp |
85e644 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|