From 570e2b1a04ef8ec53e236b0bdd2fae2c777e3268 Mon Sep 17 00:00:00 2001 From: Paul Pluzhnikov Date: Tue, 7 Jul 2009 19:36:09 +0000 Subject: [PATCH] 2009-07-07 Paul Pluzhnikov * python/python-value.c (valpy_getitem): Don't return from TRY_CATCH. --- gdb/ChangeLog | 4 ++++ gdb/python/python-value.c | 16 ++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 56480f10298..1178a93ddf7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2009-07-07 Paul Pluzhnikov + + * python/python-value.c (valpy_getitem): Don't return from TRY_CATCH. + 2009-07-07 Sami Wagiaalla * cp-support.h (struct using_direct): Rename members inner and diff --git a/gdb/python/python-value.c b/gdb/python/python-value.c index 5304cafa2a6..948ff06d366 100644 --- a/gdb/python/python-value.c +++ b/gdb/python/python-value.c @@ -267,8 +267,7 @@ valpy_getitem (PyObject *self, PyObject *key) { value_object *self_value = (value_object *) self; char *field = NULL; - struct value *idx = NULL; - struct value *res_val = NULL; /* Initialize to appease gcc warning. */ + struct value *res_val = NULL; volatile struct gdb_exception except; if (gdbpy_is_string (key)) @@ -290,12 +289,17 @@ valpy_getitem (PyObject *self, PyObject *key) value code throw an exception if the index has an invalid type. */ struct value *idx = convert_value_from_python (key); - if (idx == NULL) - return NULL; - - res_val = value_subscript (tmp, value_as_long (idx)); + if (idx != NULL) + res_val = value_subscript (tmp, value_as_long (idx)); } } + + if (res_val == NULL) + { + gdb_assert (field == NULL); + return NULL; + } + if (field) xfree (field); GDB_PY_HANDLE_EXCEPTION (except); -- 2.30.2