[patch] [python] Use TRY_CATCH in some functions.

Tom Tromey tromey@redhat.com
Thu Oct 20 14:23:00 GMT 2011


>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:

Phil> +      if (except.reason < 0)
Phil> +	{
Phil> +	  PyErr_Format (except.reason == RETURN_QUIT
Phil> +			? PyExc_KeyboardInterrupt : PyExc_RuntimeError,
Phil> +			"%s", except.message);
Phil> +	  return NULL;

Tom> Why not GDB_PY_HANDLE_EXCEPTION here?
Tom> (And also fix up typy_lookup_typename to do the same.)

Phil> Because typy_lookup_typename and typy_lookup_type are helper
Phil> functions that return struct type, while GDB_PY_HANDLE_EXCEPTION
Phil> returns a PyObject (from gdbpy_convert_exception).  Should we have
Phil> a macro that builds an exception without returning one? We should,
Phil> I think.  But I was not going to do that in this patch context.

Ok, I see.  Thanks.
I think both those functions should use gdbpy_convert_exception, though,
instead of replicating the exception-conversion logic themselves.

Tom



More information about the Gdb-patches mailing list