This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
FYI: fix PR python/11391
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 20 Aug 2010 16:40:18 -0600
- Subject: FYI: fix PR python/11391
I plan to check this in.
PR python/11391 concerns coercion of a gdb.Value to boolean.
We currently throw an exception if we consider the Value not to be
coerceable. However, it seems more Pythonic to simply return True.
Built and regtested on x86-64 (compile farm).
Tom
2010-08-20 Tom Tromey <tromey@redhat.com>
PR python/11391:
* python/py-value.c (valpy_nonzero): Don't throw error for other
Value types.
gdb/ChangeLog | 6 ++++++
gdb/python/py-value.c | 7 ++-----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
index d547ed1..75ee0de 100644
--- a/gdb/python/py-value.c
+++ b/gdb/python/py-value.c
@@ -712,11 +712,8 @@ valpy_nonzero (PyObject *self)
TYPE_LENGTH (type),
gdbarch_byte_order (get_type_arch (type)));
else
- {
- PyErr_SetString (PyExc_TypeError, _("Attempted truth testing on invalid "
- "gdb.Value type."));
- return 0;
- }
+ /* All other values are True. */
+ return 1;
}
/* Implements ~ for value objects. */