+2013-05-20 Tom Tromey <tromey@redhat.com>
+
+ * 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.
+
2013-05-20 Tom Tromey <tromey@redhat.com>
* python/py-evts.c (gdbpy_initialize_py_events): Don't
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);
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;
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);
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;
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;
start_type_printers (void)
{
struct cleanup *cleanups;
- PyObject *type_module, *func, *result_obj = NULL;
+ PyObject *type_module, *func = NULL, *result_obj = NULL;
if (!gdb_python_initialized)
return NULL;
gdbpy_print_stack ();
goto done;
}
- make_cleanup_py_decref (type_module);
func = PyObject_GetAttrString (type_module, "get_type_recognizers");
if (func == NULL)
gdbpy_print_stack ();
goto done;
}
- make_cleanup_py_decref (func);
result_obj = PyObject_CallFunctionObjArgs (func, (char *) NULL);
if (result_obj == NULL)
gdbpy_print_stack ();
done:
+ Py_XDECREF (type_module);
+ Py_XDECREF (func);
do_cleanups (cleanups);
return result_obj;
}
apply_type_printers (void *printers, struct type *type)
{
struct cleanup *cleanups;
- PyObject *type_obj, *type_module, *func, *result_obj;
+ PyObject *type_obj, *type_module = NULL, *func = NULL;
+ PyObject *result_obj = NULL;
PyObject *printers_obj = printers;
char *result = NULL;
gdbpy_print_stack ();
goto done;
}
- make_cleanup_py_decref (type_obj);
type_module = PyImport_ImportModule ("gdb.types");
if (type_module == NULL)
gdbpy_print_stack ();
goto done;
}
- make_cleanup_py_decref (type_module);
func = PyObject_GetAttrString (type_module, "apply_type_recognizers");
if (func == NULL)
gdbpy_print_stack ();
goto done;
}
- make_cleanup_py_decref (func);
result_obj = PyObject_CallFunctionObjArgs (func, printers_obj,
type_obj, (char *) NULL);
gdbpy_print_stack ();
goto done;
}
- make_cleanup_py_decref (result_obj);
if (result_obj != Py_None)
{
}
done:
+ Py_XDECREF (type_obj);
+ Py_XDECREF (type_module);
+ Py_XDECREF (func);
+ Py_XDECREF (result_obj);
do_cleanups (cleanups);
return result;
}