From 7c66fffc1f3dae0b921ae3cf8139824804cf0705 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 29 Apr 2018 21:09:02 -0600 Subject: 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 * 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. --- gdb/varobj.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'gdb/varobj.c') diff --git a/gdb/varobj.c b/gdb/varobj.c index 4656bfa..a0df485 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -1455,9 +1455,8 @@ varobj_set_visualizer (struct varobj *var, const char *visualizer) 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 ())); -- cgit v1.1