patch 8.2.1146: not enough testing for Python
Problem: Not enough testing for Python.
Solution: Add more tests. Fix uncovered problems. (Yegappan Lakshmanan,
closes #6392)
diff --git a/src/if_py_both.h b/src/if_py_both.h
index 44b4baf..c7df93b 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -2250,6 +2250,9 @@
{
ListObject *self;
+ if (list == NULL)
+ return NULL;
+
self = (ListObject *) subtype->tp_alloc(subtype, 0);
if (self == NULL)
return NULL;
@@ -2695,6 +2698,12 @@
if (obj == NULL)
{
li = list_find(l, (long) index);
+ if (li == NULL)
+ {
+ PyErr_VIM_FORMAT(N_("internal error: failed to get Vim "
+ "list item %d"), (int) index);
+ return -1;
+ }
vimlist_remove(l, li, li);
clear_tv(&li->li_tv);
vim_free(li);
@@ -2716,6 +2725,12 @@
else
{
li = list_find(l, (long) index);
+ if (li == NULL)
+ {
+ PyErr_VIM_FORMAT(N_("internal error: failed to get Vim "
+ "list item %d"), (int) index);
+ return -1;
+ }
clear_tv(&li->li_tv);
copy_tv(&tv, &li->li_tv);
clear_tv(&tv);
@@ -3897,7 +3912,7 @@
PyObject_GC_UnTrack((void *)(self));
if (self->win && self->win != INVALID_WINDOW_VALUE)
WIN_PYTHON_REF(self->win) = NULL;
- Py_XDECREF(((PyObject *)(self->tabObject)));
+ Py_XDECREF(((PyObject *)(self->tabObject)));
PyObject_GC_Del((void *)(self));
}