Patch 8.2.2538

5 views
Skip to first unread message

Bram Moolenaar

unread,
Feb 21, 2021, 1:15:41 PM2/21/21
to vim...@googlegroups.com

Patch 8.2.2538
Problem: Crash when using Python list iterator.
Solution: Increment the list reference count. (closes #7886)
Files: src/if_py_both.h, src/testdir/test_python3.vim


*** ../vim-8.2.2537/src/if_py_both.h 2020-12-21 16:02:58.486392542 +0100
--- src/if_py_both.h 2021-02-21 19:07:35.775160811 +0100
***************
*** 2815,2820 ****
--- 2815,2821 ----
ListIterDestruct(listiterinfo_T *lii)
{
list_rem_watch(lii->list, &lii->lw);
+ list_unref(lii->list);
PyMem_Free(lii);
}

***************
*** 2850,2855 ****
--- 2851,2857 ----
list_add_watch(l, &lii->lw);
lii->lw.lw_item = l->lv_first;
lii->list = l;
+ ++l->lv_refcount;

return IterNew(lii,
(destructorfun) ListIterDestruct, (nextfun) ListIterNext,
*** ../vim-8.2.2537/src/testdir/test_python3.vim 2021-01-02 13:53:55.345783905 +0100
--- src/testdir/test_python3.vim 2021-02-21 19:06:31.375399314 +0100
***************
*** 574,579 ****
--- 574,582 ----
py3 ll[2] = 8
call assert_equal([1, 2, 8], l)

+ " iterating over list from Python
+ py3 print([x for x in vim.Function("getline")(1, 2)])
+
" Using dict as an index
call AssertException(['py3 ll[{}] = 10'],
\ 'Vim(py3):TypeError: index must be int or slice, not dict')
*** ../vim-8.2.2537/src/version.c 2021-02-21 16:20:14.252629218 +0100
--- src/version.c 2021-02-21 19:08:05.383051065 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2538,
/**/

--
TIM: That is not an ordinary rabbit ... 'tis the most foul cruel and
bad-tempered thing you ever set eyes on.
ROBIN: You tit. I soiled my armour I was so scared!
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@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 ///
Reply all
Reply to author
Forward
0 new messages