diff options
author | Bram Moolenaar <Bram@vim.org> | 2013-06-23 13:46:40 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2013-06-23 13:46:40 +0200 |
commit | c476e52fcaf9e1ad779add6368e4f46b2c0d881c (patch) | |
tree | dc1d97fee9e56a07f4f1475ef938245a419c72ae /src/if_python3.c | |
parent | 0bd80ccd853ddfa4cc2385b6ceb3b2610245a9ed (diff) | |
download | vim-c476e52fcaf9e1ad779add6368e4f46b2c0d881c.zip |
updated for version 7.3.1230
Problem: Python: Exception messages are not clear.
Solution: Make exception messages more verbose. (ZyX)
Diffstat (limited to 'src/if_python3.c')
-rw-r--r-- | src/if_python3.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/if_python3.c b/src/if_python3.c index 7155bc1c6..9bb2a4f7f 100644 --- a/src/if_python3.c +++ b/src/if_python3.c @@ -122,6 +122,7 @@ # define PyDict_SetItemString py3_PyDict_SetItemString # define PyErr_BadArgument py3_PyErr_BadArgument # define PyErr_Clear py3_PyErr_Clear +# define PyErr_Format py3_PyErr_Format # define PyErr_PrintEx py3_PyErr_PrintEx # define PyErr_NoMemory py3_PyErr_NoMemory # define PyErr_Occurred py3_PyErr_Occurred @@ -337,6 +338,7 @@ static int (*py3_PyMem_Free)(void *); static void* (*py3_PyMem_Malloc)(size_t); static int (*py3_Py_IsInitialized)(void); static void (*py3_PyErr_Clear)(void); +static PyObject* (*py3_PyErr_Format)(PyObject *, const char *, ...); static void (*py3_PyErr_PrintEx)(int); static PyObject*(*py3__PyObject_Init)(PyObject *, PyTypeObject *); static iternextfunc py3__PyObject_NextNotImplemented; @@ -485,6 +487,7 @@ static struct {"_Py_FalseStruct", (PYTHON_PROC*)&py3__Py_FalseStruct}, {"_Py_TrueStruct", (PYTHON_PROC*)&py3__Py_TrueStruct}, {"PyErr_Clear", (PYTHON_PROC*)&py3_PyErr_Clear}, + {"PyErr_Format", (PYTHON_PROC*)&py3_PyErr_Format}, {"PyErr_PrintEx", (PYTHON_PROC*)&py3_PyErr_PrintEx}, {"PyObject_Init", (PYTHON_PROC*)&py3__PyObject_Init}, {"PyModule_AddObject", (PYTHON_PROC*)&py3_PyModule_AddObject}, @@ -1169,7 +1172,7 @@ BufferSubscript(PyObject *self, PyObject* idx) } else { - PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice"); + RAISE_INVALID_INDEX_TYPE(idx); return NULL; } } @@ -1203,7 +1206,7 @@ BufferAsSubscript(PyObject *self, PyObject* idx, PyObject* val) } else { - PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice"); + RAISE_INVALID_INDEX_TYPE(idx); return -1; } } @@ -1285,7 +1288,7 @@ RangeSubscript(PyObject *self, PyObject* idx) } else { - PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice"); + RAISE_INVALID_INDEX_TYPE(idx); return NULL; } } @@ -1312,7 +1315,7 @@ RangeAsSubscript(PyObject *self, PyObject *idx, PyObject *val) } else { - PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice"); + RAISE_INVALID_INDEX_TYPE(idx); return -1; } } @@ -1491,7 +1494,7 @@ ListSubscript(PyObject *self, PyObject* idx) } else { - PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice"); + RAISE_INVALID_INDEX_TYPE(idx); return NULL; } } @@ -1515,7 +1518,7 @@ ListAsSubscript(PyObject *self, PyObject *idx, PyObject *obj) } else { - PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice"); + RAISE_INVALID_INDEX_TYPE(idx); return -1; } } |