From ec9c2750b7bab8a55aaf7d2386e809d4e81deb03 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 25 Dec 2018 11:00:21 -0700 Subject: Use gdbpy_convert_exception in a few more spots I noticed a few places were converting a gdb exception to a Python exception "by hand". It's better to use the existing gdbpy_convert_exception helper function, as this handles memory errors correctly, and in the future may be enhanced in other ways. gdb/ChangeLog 2018-12-27 Tom Tromey * python/py-value.c (convert_value_from_python): Use gdbpy_convert_exception. * python/py-param.c (parmpy_init): Use gdbpy_convert_exception. * python/py-cmd.c (cmdpy_init): Use gdbpy_convert_exception. * python/py-breakpoint.c (bppy_init): Use gdbpy_convert_exception. --- gdb/python/py-cmd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'gdb/python/py-cmd.c') diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c index 0e39730..8fca90e 100644 --- a/gdb/python/py-cmd.c +++ b/gdb/python/py-cmd.c @@ -579,9 +579,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw) xfree (docstring); xfree (pfx_name); Py_DECREF (self); - PyErr_Format (except.reason == RETURN_QUIT - ? PyExc_KeyboardInterrupt : PyExc_RuntimeError, - "%s", except.message); + gdbpy_convert_exception (except); return -1; } END_CATCH -- cgit v1.1