aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/python/py-cmd.c')
-rw-r--r--gdb/python/py-cmd.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index 3de3af2..245d66a 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -279,9 +279,14 @@ cmdpy_completer (struct cmd_list_element *command, char *text, char *word)
{
/* User code may also return one of the completion constants,
thus requesting that sort of completion. */
- long value = PyInt_AsLong (resultobj);
+ long value;
- if (value >= 0 && value < (long) N_COMPLETERS)
+ if (! gdb_py_int_as_long (resultobj, &value))
+ {
+ /* Ignore. */
+ PyErr_Clear ();
+ }
+ else if (value >= 0 && value < (long) N_COMPLETERS)
result = completers[value].completer (command, text, word);
}