From 1957f6b89f3db02d51e3e3361de6af073a03f19d Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 18 May 2016 21:41:28 -0600 Subject: Fix PR python/17981 PR python/17981 notes that gdb.breakpoints() returns None when there are no breakpoints; whereas an empty list or tuple would be more in keeping with Python and the documentation. This patch fixes the bug by changing the no-breakpoint return to make an empty tuple. Built and regtested on x86-64 Fedora 23. 2016-05-23 Tom Tromey PR python/17981: * python/py-breakpoint.c (gdbpy_breakpoints): Return a new tuple when there are no breakpoints. 2016-05-23 Tom Tromey * python.texi (Basic Python): Document gdb.breakpoints return. 2016-05-23 Tom Tromey PR python/17981: * gdb.python/py-breakpoint.exp (test_bkpt_basic): Add test for no-breakpoint case. --- gdb/python/py-breakpoint.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gdb/python') diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c index 611a41e..ed9cae6 100644 --- a/gdb/python/py-breakpoint.c +++ b/gdb/python/py-breakpoint.c @@ -746,13 +746,13 @@ gdbpy_breakpoints (PyObject *self, PyObject *args) PyObject *list, *tuple; if (bppy_live == 0) - Py_RETURN_NONE; + return PyTuple_New (0); list = PyList_New (0); if (!list) return NULL; - /* If iteratre_over_breakpoints returns non NULL it signals an error + /* If iterate_over_breakpoints returns non NULL it signals an error condition. In that case abandon building the list and return NULL. */ if (iterate_over_breakpoints (build_bp_list, list) != NULL) -- cgit v1.1