[python] [rfc] Patch for pretty-printers registration API change
Tom Tromey
tromey@redhat.com
Fri Feb 20 19:38:00 GMT 2009
Phil> I elected propagation. I was not terribly sure in the CLI case if I
Phil> should start applying the gdb error () and gdbpy_print_stack () inside
Phil> apply_val_pretty_printer () .. or allow the error to propagate
Phil> further. I elected to let them continue as that was the case
Phil> beforehand. We can easily change this. What do you think?
I think it is probably fine to just print the exception trace and
continue here.
Phil> + printer = gdbpy_instantiate_printer (function, value);
Phil> + if (! printer)
Phil> + return NULL;
Phil> + else if (printer != Py_None)
Phil> + return printer;
[...]
Phil> + Py_DECREF (Py_None);
I think it is much clearer to write Py_DECREF (printer) here.
Decreffing Py_None looks very weird to me.
Phil> + if (! function)
Phil> + {
Phil> + Py_XDECREF (pp_list);
Phil> + return NULL;
Phil> + }
Phil> - Py_DECREF (dict);
Phil> + if (function && function != Py_None)
Phil> + goto done;
I think the !function case above means that you don't have to test
function in the second if.
The function get_type is now unused, please delete it.
The 'value' argument to apply_varobj_pretty_printer is also unused --
remove it as well.
This patch is ok with the above changes.
thanks,
Tom
More information about the Archer
mailing list