From 1bdb0c5472c10b1af38b915df48ceee417192aa3 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 12 Oct 2010 22:44:20 +0000 Subject: * python/py-prettyprint.c (search_pp_list): Fix error checking. --- gdb/python/py-prettyprint.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'gdb/python') diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c index 434c8a5..7aa83bc 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) -- cgit v1.1