From af6abb9d93959d801d40a2d77a96962cef2335fc Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 24 Apr 2013 13:04:26 +0200 Subject: updated for version 7.3.907 Problem: Python uses IndexError when a dict key is not found. Solution: Use KeyError instead. (ZyX) --- src/if_python.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/if_python.c') diff --git a/src/if_python.c b/src/if_python.c index 89cb0334b..0f90c9903 100644 --- a/src/if_python.c +++ b/src/if_python.c @@ -348,12 +348,14 @@ static HINSTANCE hinstPython = 0; /* Instance of python.dll */ /* Imported exception objects */ static PyObject *imp_PyExc_AttributeError; static PyObject *imp_PyExc_IndexError; +static PyObject *imp_PyExc_KeyError; static PyObject *imp_PyExc_KeyboardInterrupt; static PyObject *imp_PyExc_TypeError; static PyObject *imp_PyExc_ValueError; # define PyExc_AttributeError imp_PyExc_AttributeError # define PyExc_IndexError imp_PyExc_IndexError +# define PyExc_KeyError imp_PyExc_KeyError # define PyExc_KeyboardInterrupt imp_PyExc_KeyboardInterrupt # define PyExc_TypeError imp_PyExc_TypeError # define PyExc_ValueError imp_PyExc_ValueError @@ -579,11 +581,13 @@ get_exceptions(void) PyObject *exdict = PyModule_GetDict(exmod); imp_PyExc_AttributeError = PyDict_GetItemString(exdict, "AttributeError"); imp_PyExc_IndexError = PyDict_GetItemString(exdict, "IndexError"); + imp_PyExc_KeyError = PyDict_GetItemString(exdict, "KeyError"); imp_PyExc_KeyboardInterrupt = PyDict_GetItemString(exdict, "KeyboardInterrupt"); imp_PyExc_TypeError = PyDict_GetItemString(exdict, "TypeError"); imp_PyExc_ValueError = PyDict_GetItemString(exdict, "ValueError"); Py_XINCREF(imp_PyExc_AttributeError); Py_XINCREF(imp_PyExc_IndexError); + Py_XINCREF(imp_PyExc_KeyError); Py_XINCREF(imp_PyExc_KeyboardInterrupt); Py_XINCREF(imp_PyExc_TypeError); Py_XINCREF(imp_PyExc_ValueError); -- cgit v1.2.1