diff src/if_python3.c @ 21190:10eb6c38938c v8.2.1146

patch 8.2.1146: not enough testing for Python Commit: https://github.com/vim/vim/commit/ab5894638413748fcedfe28691e6c27893924520 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jul 6 21:03:06 2020 +0200 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)
author Bram Moolenaar <Bram@vim.org>
date Mon, 06 Jul 2020 21:15:05 +0200
parents 4acb165ed0bc
children 8488d9cc3ccd
line wrap: on
line diff
--- a/src/if_python3.c
+++ b/src/if_python3.c
@@ -1256,6 +1256,10 @@ BufferAsSubscript(PyObject *self, PyObje
     if (PyLong_Check(idx))
     {
 	long n = PyLong_AsLong(idx);
+
+	if (CheckBuffer((BufferObject *) self))
+	    return -1;
+
 	return RBAsItem((BufferObject *)(self), n, val, 1,
 		    (Py_ssize_t)((BufferObject *)(self))->buf->b_ml.ml_line_count,
 		    NULL);