* [python] fix buglet in python-value.c
@ 2009-08-24 18:26 Tom Tromey
0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2009-08-24 18:26 UTC (permalink / raw)
To: Project Archer
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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-08-24 18:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-24 18:26 [python] fix buglet in python-value.c Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).