Python pretty-printing [3/6]
Tom Tromey
tromey@redhat.com
Wed Apr 8 18:26:00 GMT 2009
>>>>> "Thiago" == Thiago Jung Bauermann <bauerman@br.ibm.com> writes:
Tom> + if (except.reason < 0)
Tom> + {
Tom> + PyErr_Format (except.reason == RETURN_QUIT
Tom> + ? PyExc_KeyboardInterrupt : PyExc_RuntimeError,
Tom> + "%s", except.message);
Tom> + return NULL;
Tom> + }
Thiago> Perhaps this is nitpicking, but: any reason why you don't use
Thiago> GDB_PY_HANDLE_EXCEPTION here? This code seems to do the same thing.
GDB_PY_HANDLE_EXCEPTION does "return PyErr_Format...", which means the
return uses the wrong type. (I didn't see this at first either, I
found out by trying :-)
[ methods ]
Thiago> I think most of these methods could be attributes instead. The ones
Thiago> which should stay as methods are those who have side-effects (like
Thiago> causing a symtab to be loaded, or somesuch). Even the methods which
Thiago> create new types only do so if the requested type doesn't exist yet,
Thiago> IIUC. Are there side-effects in, say, Type.pointer or Type.reference?
I changed a few to be attributes: code, sizeof, and tag.
The rest I left as methods. It seemed reasonable to me that requests
for type variants (or pointer-to or reference-to or whatever) should
be methods. They may cause a new type to be created.
Tom
More information about the Gdb-patches
mailing list