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 <tom@tromey.com> * 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.
This commit is contained in:
parent
6987262214
commit
ec9c2750b7
5 changed files with 13 additions and 12 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2018-12-27 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2018-12-27 Tom Tromey <tom@tromey.com>
|
2018-12-27 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* configure.nat (NATDEPFILES): Use nat/ prefix.
|
* configure.nat (NATDEPFILES): Use nat/ prefix.
|
||||||
|
|
|
@ -874,9 +874,7 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
|
||||||
CATCH (except, RETURN_MASK_ALL)
|
CATCH (except, RETURN_MASK_ALL)
|
||||||
{
|
{
|
||||||
bppy_pending_object = NULL;
|
bppy_pending_object = NULL;
|
||||||
PyErr_Format (except.reason == RETURN_QUIT
|
gdbpy_convert_exception (except);
|
||||||
? PyExc_KeyboardInterrupt : PyExc_RuntimeError,
|
|
||||||
"%s", except.message);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
END_CATCH
|
END_CATCH
|
||||||
|
|
|
@ -579,9 +579,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
|
||||||
xfree (docstring);
|
xfree (docstring);
|
||||||
xfree (pfx_name);
|
xfree (pfx_name);
|
||||||
Py_DECREF (self);
|
Py_DECREF (self);
|
||||||
PyErr_Format (except.reason == RETURN_QUIT
|
gdbpy_convert_exception (except);
|
||||||
? PyExc_KeyboardInterrupt : PyExc_RuntimeError,
|
|
||||||
"%s", except.message);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
END_CATCH
|
END_CATCH
|
||||||
|
|
|
@ -738,9 +738,7 @@ parmpy_init (PyObject *self, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
xfree (cmd_name);
|
xfree (cmd_name);
|
||||||
Py_DECREF (self);
|
Py_DECREF (self);
|
||||||
PyErr_Format (except.reason == RETURN_QUIT
|
gdbpy_convert_exception (except);
|
||||||
? PyExc_KeyboardInterrupt : PyExc_RuntimeError,
|
|
||||||
"%s", except.message);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
END_CATCH
|
END_CATCH
|
||||||
|
|
|
@ -1732,9 +1732,7 @@ convert_value_from_python (PyObject *obj)
|
||||||
}
|
}
|
||||||
CATCH (except, RETURN_MASK_ALL)
|
CATCH (except, RETURN_MASK_ALL)
|
||||||
{
|
{
|
||||||
PyErr_Format (except.reason == RETURN_QUIT
|
gdbpy_convert_exception (except);
|
||||||
? PyExc_KeyboardInterrupt : PyExc_RuntimeError,
|
|
||||||
"%s", except.message);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
END_CATCH
|
END_CATCH
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue