mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-09-19 17:24:14 +08: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:
@ -876,10 +876,7 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
|
||||
}
|
||||
}
|
||||
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)
|
||||
@ -892,10 +889,7 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
|
||||
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 ());
|
||||
|
Reference in New Issue
Block a user