summaryrefslogtreecommitdiff
path: root/src/if_py_both.h
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-07-06 21:03:06 +0200
committerBram Moolenaar <Bram@vim.org>2020-07-06 21:03:06 +0200
commitab5894638413748fcedfe28691e6c27893924520 (patch)
tree45318c835f879c4ff5f235f7774c37f5a6a9d359 /src/if_py_both.h
parent0ad3e894d75236915e67dfbbcc821b6bb3c05d91 (diff)
downloadvim-git-ab5894638413748fcedfe28691e6c27893924520.tar.gz
patch 8.2.1146: not enough testing for Pythonv8.2.1146
Problem: Not enough testing for Python. Solution: Add more tests. Fix uncovered problems. (Yegappan Lakshmanan, closes #6392)
Diffstat (limited to 'src/if_py_both.h')
-rw-r--r--src/if_py_both.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/if_py_both.h b/src/if_py_both.h
index 44b4baffe..c7df93be2 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -2250,6 +2250,9 @@ ListNew(PyTypeObject *subtype, list_T *list)
{
ListObject *self;
+ if (list == NULL)
+ return NULL;
+
self = (ListObject *) subtype->tp_alloc(subtype, 0);
if (self == NULL)
return NULL;
@@ -2695,6 +2698,12 @@ ListAssIndex(ListObject *self, Py_ssize_t index, PyObject *obj)
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 @@ ListAssIndex(ListObject *self, Py_ssize_t index, PyObject *obj)
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 @@ WindowDestructor(WindowObject *self)
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));
}