This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
[python] fix buglet in python-value.c
- From: Tom Tromey <tromey at redhat dot com>
- To: Project Archer <archer at sourceware dot org>
- Date: Mon, 24 Aug 2009 12:26:09 -0600
- Subject: [python] fix buglet in python-value.c
- Reply-to: tromey at redhat dot com
I'm checking this in on the python branch.
I'm also going to send it upstream shortly.
It is not ok to "return" from the inside of a TRY_CATCH.
This will cause a crash later.
Tom
2009-08-24 Tom Tromey <tromey@redhat.com>
* python/python-value.c (valpy_richcompare): Don't return from
inside a TRY_CATCH.
diff --git a/gdb/python/python-value.c b/gdb/python/python-value.c
index f34df79..159c118 100644
--- a/gdb/python/python-value.c
+++ b/gdb/python/python-value.c
@@ -697,7 +697,10 @@ valpy_richcompare (PyObject *self, PyObject *other, int op)
{
value_other = convert_value_from_python (other);
if (value_other == NULL)
- return NULL;
+ {
+ result = -1;
+ break;
+ }
switch (op) {
case Py_LT:
@@ -724,11 +727,16 @@ valpy_richcompare (PyObject *self, PyObject *other, int op)
/* Can't happen. */
PyErr_SetString (PyExc_NotImplementedError,
"Invalid operation on gdb.Value.");
- return NULL;
+ result = -1;
+ break;
}
}
GDB_PY_HANDLE_EXCEPTION (except);
+ /* In this case, the Python exception has already been set. */
+ if (result < 0)
+ return NULL;
+
if (result == 1)
Py_RETURN_TRUE;