mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-15 03:48:28 +00:00
Change Python code to use new_reference
This changes a few spots in the Python code to use new_reference rather than the manual incref+constructor that was previously being done. ChangeLog 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.
This commit is contained in:
@@ -138,8 +138,8 @@ cmdpy_function (struct cmd_list_element *command,
|
||||
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));
|
||||
@@ -246,8 +246,7 @@ cmdpy_completer_helper (struct cmd_list_element *command,
|
||||
if (word == NULL)
|
||||
{
|
||||
/* "brkchars" phase. */
|
||||
wordobj.reset (Py_None);
|
||||
Py_INCREF (Py_None);
|
||||
wordobj = gdbpy_ref<>::new_reference (Py_None);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user