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