* python/py-prettyprint.c (search_pp_list): Fix error checking.
authorTom Tromey <tromey@redhat.com>
Tue, 12 Oct 2010 22:44:20 +0000 (22:44 +0000)
committerTom Tromey <tromey@redhat.com>
Tue, 12 Oct 2010 22:44:20 +0000 (22:44 +0000)
gdb/ChangeLog
gdb/python/py-prettyprint.c

index 5938dadbd759185a6f73d0833017a39af75853a7..55bf57a26f763e7f5718ab0bbf2da4c2b3060a9c 100644 (file)
@@ -1,3 +1,7 @@
+2010-10-12  Tom Tromey  <tromey@redhat.com>
+
+       * python/py-prettyprint.c (search_pp_list): Fix error checking.
+
 2010-10-12  Sami Wagiaalla  <swagiaal@redhat.com>
 
        * gdbtypes.c (do_is_ancestor): New function.
index 434c8a593da3aa703453d9b936caaf41b6b5faa2..7aa83bce41a733ec3d6837c2bd3014bd3129d612 100644 (file)
@@ -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)