+2018-04-30 Tom Tromey <tom@tromey.com>
+
+ * varobj.c (varobj_set_visualizer): Use new_reference.
+ * python/python.c (gdbpy_decode_line): Use new_reference.
+ * python/py-cmd.c (cmdpy_function, cmdpy_completer_helper): Use
+ new_reference.
+
2018-04-30 Tom Tromey <tom@tromey.com>
* varobj.c (install_new_value): Use new_reference.
error (_("Could not convert arguments to Python string."));
}
- gdbpy_ref<> ttyobj (from_tty ? Py_True : Py_False);
- Py_INCREF (ttyobj.get ());
+ gdbpy_ref<> ttyobj
+ = gdbpy_ref<>::new_reference (from_tty ? Py_True : Py_False);
gdbpy_ref<> result (PyObject_CallMethodObjArgs ((PyObject *) obj, invoke_cst,
argobj.get (), ttyobj.get (),
NULL));
if (word == NULL)
{
/* "brkchars" phase. */
- wordobj.reset (Py_None);
- Py_INCREF (Py_None);
+ wordobj = gdbpy_ref<>::new_reference (Py_None);
}
else
{
}
}
else
- {
- result.reset (Py_None);
- Py_INCREF (Py_None);
- }
+ result = gdbpy_ref<>::new_reference (Py_None);
gdbpy_ref<> return_result (PyTuple_New (2));
if (return_result == NULL)
return NULL;
}
else
- {
- unparsed.reset (Py_None);
- Py_INCREF (Py_None);
- }
+ unparsed = gdbpy_ref<>::new_reference (Py_None);
PyTuple_SetItem (return_result.get (), 0, unparsed.release ());
PyTuple_SetItem (return_result.get (), 1, result.release ());
gdbpy_enter_varobj enter_py (var);
mainmod = PyImport_AddModule ("__main__");
- gdbpy_ref<> globals (PyModule_GetDict (mainmod));
- Py_INCREF (globals.get ());
-
+ gdbpy_ref<> globals
+ = gdbpy_ref<>::new_reference (PyModule_GetDict (mainmod));
gdbpy_ref<> constructor (PyRun_String (visualizer, Py_eval_input,
globals.get (), globals.get ()));