From 3d4a3c3ea2536c69a01c8c13b851784aa1b5d956 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 20 May 2013 20:34:49 +0000 Subject: * python/py-cmd.c (cmdpy_completer): Use explicit decref. * python/py-param.c (get_set_value, get_show_value): Use explicit decrefs. * python/python.c (start_type_printers, apply_type_printers): Use explicit decrefs. --- gdb/python/py-param.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'gdb/python/py-param.c') diff --git a/gdb/python/py-param.c b/gdb/python/py-param.c index fbd9a77..a81ab66 100644 --- a/gdb/python/py-param.c +++ b/gdb/python/py-param.c @@ -374,8 +374,6 @@ get_set_value (char *args, int from_tty, if (! set_doc_func) goto error; - make_cleanup_py_decref (set_doc_func); - if (PyObject_HasAttr (obj, set_doc_func)) { set_doc_string = call_doc_function (obj, set_doc_func, NULL); @@ -393,10 +391,12 @@ get_set_value (char *args, int from_tty, make_cleanup (xfree, set_doc_string); fprintf_filtered (gdb_stdout, "%s\n", set_doc_string); + Py_XDECREF (set_doc_func); do_cleanups (cleanup); return; error: + Py_XDECREF (set_doc_func); gdbpy_print_stack (); do_cleanups (cleanup); return; @@ -422,8 +422,6 @@ get_show_value (struct ui_file *file, int from_tty, if (! show_doc_func) goto error; - make_cleanup_py_decref (show_doc_func); - if (PyObject_HasAttr (obj, show_doc_func)) { PyObject *val_obj = PyString_FromString (value); @@ -431,9 +429,8 @@ get_show_value (struct ui_file *file, int from_tty, if (! val_obj) goto error; - make_cleanup_py_decref (val_obj); - show_doc_string = call_doc_function (obj, show_doc_func, val_obj); + Py_DECREF (val_obj); if (! show_doc_string) goto error; @@ -451,10 +448,12 @@ get_show_value (struct ui_file *file, int from_tty, fprintf_filtered (file, "%s %s\n", show_doc_string, value); } + Py_XDECREF (show_doc_func); do_cleanups (cleanup); return; error: + Py_XDECREF (show_doc_func); gdbpy_print_stack (); do_cleanups (cleanup); return; -- cgit v1.1