This is the mail archive of the archer@sourceware.org mailing list for the Archer project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [python] [rfc] Patch for pretty-printers registration API change


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]