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

Tom Tromey
2011-10-20T14:10:05Z

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