This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: [patch] [python] Use TRY_CATCH in some functions.


>>>>> "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


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