diff options
author | Bram Moolenaar <Bram@vim.org> | 2013-04-24 13:04:26 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2013-04-24 13:04:26 +0200 |
commit | af6abb9d93959d801d40a2d77a96962cef2335fc (patch) | |
tree | 2a4c39066970fd372b41b351535429df0f6e3b31 /src/if_python3.c | |
parent | 3f99152276def2b8f88a3dd5f87f645e9e875da2 (diff) | |
download | vim-af6abb9d93959d801d40a2d77a96962cef2335fc.zip |
updated for version 7.3.907
Problem: Python uses IndexError when a dict key is not found.
Solution: Use KeyError instead. (ZyX)
Diffstat (limited to 'src/if_python3.c')
-rw-r--r-- | src/if_python3.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/if_python3.c b/src/if_python3.c index d8f757475..2a66cfada 100644 --- a/src/if_python3.c +++ b/src/if_python3.c @@ -327,12 +327,14 @@ static HINSTANCE hinstPy3 = 0; /* Instance of python.dll */ /* Imported exception objects */ static PyObject *p3imp_PyExc_AttributeError; static PyObject *p3imp_PyExc_IndexError; +static PyObject *p3imp_PyExc_KeyError; static PyObject *p3imp_PyExc_KeyboardInterrupt; static PyObject *p3imp_PyExc_TypeError; static PyObject *p3imp_PyExc_ValueError; # define PyExc_AttributeError p3imp_PyExc_AttributeError # define PyExc_IndexError p3imp_PyExc_IndexError +# define PyExc_KeyError p3imp_PyExc_KeyError # define PyExc_KeyboardInterrupt p3imp_PyExc_KeyboardInterrupt # define PyExc_TypeError p3imp_PyExc_TypeError # define PyExc_ValueError p3imp_PyExc_ValueError @@ -567,11 +569,13 @@ get_py3_exceptions() PyObject *exdict = PyModule_GetDict(exmod); p3imp_PyExc_AttributeError = PyDict_GetItemString(exdict, "AttributeError"); p3imp_PyExc_IndexError = PyDict_GetItemString(exdict, "IndexError"); + p3imp_PyExc_KeyError = PyDict_GetItemString(exdict, "KeyError"); p3imp_PyExc_KeyboardInterrupt = PyDict_GetItemString(exdict, "KeyboardInterrupt"); p3imp_PyExc_TypeError = PyDict_GetItemString(exdict, "TypeError"); p3imp_PyExc_ValueError = PyDict_GetItemString(exdict, "ValueError"); Py_XINCREF(p3imp_PyExc_AttributeError); Py_XINCREF(p3imp_PyExc_IndexError); + Py_XINCREF(p3imp_PyExc_KeyError); Py_XINCREF(p3imp_PyExc_KeyboardInterrupt); Py_XINCREF(p3imp_PyExc_TypeError); Py_XINCREF(p3imp_PyExc_ValueError); |