summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-05-15 15:35:09 +0200
committerBram Moolenaar <Bram@vim.org>2013-05-15 15:35:09 +0200
commit4d188da22bc42b58ed66746c8d6235616214e55f (patch)
treee8c93bef490ad575b47925682fc16a1b46a34855
parent5e538ecd5e68b90f630be7bb177ab64e1285e40b (diff)
downloadvim-4d188da22bc42b58ed66746c8d6235616214e55f.zip
updated for version 7.3.950
Problem: Python: Stack trace printer can't handle messages. Solution: Make KeyErrors use PyErr_SetObject. (ZyX)
-rw-r--r--src/if_py_both.h10
-rw-r--r--src/if_python.c3
-rw-r--r--src/if_python3.c3
-rw-r--r--src/version.c2
4 files changed, 13 insertions, 5 deletions
diff --git a/src/if_py_both.h b/src/if_py_both.h
index b80a3e24a..285054030 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -734,7 +734,7 @@ DictionaryItem(PyObject *self, PyObject *keyObject)
if (di == NULL)
{
- PyErr_SetString(PyExc_KeyError, _("no such key in dictionary"));
+ PyErr_SetObject(PyExc_KeyError, keyObject);
return NULL;
}
@@ -767,7 +767,7 @@ DictionaryAssItem(PyObject *self, PyObject *keyObject, PyObject *valObject)
if (di == NULL)
{
DICTKEY_UNREF
- PyErr_SetString(PyExc_IndexError, _("no such key in dictionary"));
+ PyErr_SetObject(PyExc_KeyError, keyObject);
return -1;
}
hi = hash_find(&d->dv_hashtab, di->di_key);
@@ -1353,7 +1353,7 @@ OptionsItem(OptionsObject *this, PyObject *keyObject)
if (flags == 0)
{
- PyErr_SetString(PyExc_KeyError, "Option does not exist in given scope");
+ PyErr_SetObject(PyExc_KeyError, keyObject);
return NULL;
}
@@ -1447,7 +1447,7 @@ OptionsAssItem(OptionsObject *this, PyObject *keyObject, PyObject *valObject)
if (flags == 0)
{
- PyErr_SetString(PyExc_KeyError, "Option does not exist in given scope");
+ PyErr_SetObject(PyExc_KeyError, keyObject);
return -1;
}
@@ -3145,7 +3145,7 @@ BufMapItem(PyObject *self UNUSED, PyObject *keyObject)
return BufferNew(b);
else
{
- PyErr_SetString(PyExc_KeyError, _("no such buffer"));
+ PyErr_SetObject(PyExc_KeyError, keyObject);
return NULL;
}
}
diff --git a/src/if_python.c b/src/if_python.c
index b756c3c6a..edbba2133 100644
--- a/src/if_python.c
+++ b/src/if_python.c
@@ -155,6 +155,7 @@ struct PyMethodDef { Py_ssize_t a; };
# define PyErr_Occurred dll_PyErr_Occurred
# define PyErr_SetNone dll_PyErr_SetNone
# define PyErr_SetString dll_PyErr_SetString
+# define PyErr_SetObject dll_PyErr_SetObject
# define PyEval_InitThreads dll_PyEval_InitThreads
# define PyEval_RestoreThread dll_PyEval_RestoreThread
# define PyEval_SaveThread dll_PyEval_SaveThread
@@ -260,6 +261,7 @@ static PyObject*(*dll_PyErr_NoMemory)(void);
static PyObject*(*dll_PyErr_Occurred)(void);
static void(*dll_PyErr_SetNone)(PyObject *);
static void(*dll_PyErr_SetString)(PyObject *, const char *);
+static void(*dll_PyErr_SetObject)(PyObject *, PyObject *);
static void(*dll_PyEval_InitThreads)(void);
static void(*dll_PyEval_RestoreThread)(PyThreadState *);
static PyThreadState*(*dll_PyEval_SaveThread)(void);
@@ -393,6 +395,7 @@ static struct
{"PyErr_Occurred", (PYTHON_PROC*)&dll_PyErr_Occurred},
{"PyErr_SetNone", (PYTHON_PROC*)&dll_PyErr_SetNone},
{"PyErr_SetString", (PYTHON_PROC*)&dll_PyErr_SetString},
+ {"PyErr_SetObject", (PYTHON_PROC*)&dll_PyErr_SetObject},
{"PyEval_InitThreads", (PYTHON_PROC*)&dll_PyEval_InitThreads},
{"PyEval_RestoreThread", (PYTHON_PROC*)&dll_PyEval_RestoreThread},
{"PyEval_SaveThread", (PYTHON_PROC*)&dll_PyEval_SaveThread},
diff --git a/src/if_python3.c b/src/if_python3.c
index f32aca405..8acab9d55 100644
--- a/src/if_python3.c
+++ b/src/if_python3.c
@@ -128,6 +128,7 @@ static void init_structs(void);
# define PyErr_Occurred py3_PyErr_Occurred
# define PyErr_SetNone py3_PyErr_SetNone
# define PyErr_SetString py3_PyErr_SetString
+# define PyErr_SetObject py3_PyErr_SetObject
# define PyEval_InitThreads py3_PyEval_InitThreads
# define PyEval_RestoreThread py3_PyEval_RestoreThread
# define PyEval_SaveThread py3_PyEval_SaveThread
@@ -250,6 +251,7 @@ static int (*py3_PySlice_GetIndicesEx)(PyObject *r, Py_ssize_t length,
static PyObject* (*py3_PyErr_NoMemory)(void);
static void (*py3_Py_Finalize)(void);
static void (*py3_PyErr_SetString)(PyObject *, const char *);
+static void (*py3_PyErr_SetObject)(PyObject *, PyObject *);
static int (*py3_PyRun_SimpleString)(char *);
static PyObject* (*py3_PyRun_String)(char *, int, PyObject *, PyObject *);
static PyObject* (*py3_PyList_GetItem)(PyObject *, Py_ssize_t);
@@ -379,6 +381,7 @@ static struct
{"PyErr_NoMemory", (PYTHON_PROC*)&py3_PyErr_NoMemory},
{"Py_Finalize", (PYTHON_PROC*)&py3_Py_Finalize},
{"PyErr_SetString", (PYTHON_PROC*)&py3_PyErr_SetString},
+ {"PyErr_SetObject", (PYTHON_PROC*)&py3_PyErr_SetObject},
{"PyRun_SimpleString", (PYTHON_PROC*)&py3_PyRun_SimpleString},
{"PyRun_String", (PYTHON_PROC*)&py3_PyRun_String},
{"PyList_GetItem", (PYTHON_PROC*)&py3_PyList_GetItem},
diff --git a/src/version.c b/src/version.c
index 6c41c4642..eb7d0db92 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 950,
+/**/
949,
/**/
948,