From: Tom Tromey Date: Tue, 12 Oct 2010 22:44:20 +0000 (+0000) Subject: * python/py-prettyprint.c (search_pp_list): Fix error checking. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1bdb0c5472c10b1af38b915df48ceee417192aa3;p=binutils-gdb.git * python/py-prettyprint.c (search_pp_list): Fix error checking. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5938dadbd75..55bf57a26f7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2010-10-12 Tom Tromey + + * python/py-prettyprint.c (search_pp_list): Fix error checking. + 2010-10-12 Sami Wagiaalla * gdbtypes.c (do_is_ancestor): New function. diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c index 434c8a593da..7aa83bce41a 100644 --- a/gdb/python/py-prettyprint.c +++ b/gdb/python/py-prettyprint.c @@ -49,9 +49,20 @@ search_pp_list (PyObject *list, PyObject *value) return NULL; /* Skip if disabled. */ - if (PyObject_HasAttr (function, gdbpy_enabled_cst) - && ! PyObject_IsTrue (PyObject_GetAttr (function, gdbpy_enabled_cst))) - continue; + if (PyObject_HasAttr (function, gdbpy_enabled_cst)) + { + PyObject *attr = PyObject_GetAttr (function, gdbpy_enabled_cst); + int cmp; + + if (!attr) + return NULL; + cmp = PyObject_IsTrue (attr); + if (cmp == -1) + return NULL; + + if (!cmp) + continue; + } printer = PyObject_CallFunctionObjArgs (function, value, NULL); if (! printer)