[python][patch] And range method to type

Tom Tromey tromey@redhat.com
Fri Dec 4 18:13:00 GMT 2009


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

Phil> This patch adds a "range" method for GDB.Types.  It only supports types
Phil> that support a range, or the range type itself.

Phil> +  if (TYPE_CODE (type) != TYPE_CODE_ARRAY &&
Phil> +      TYPE_CODE (type) != TYPE_CODE_STRING &&
Phil> +      TYPE_CODE (type) != TYPE_CODE_RANGE)

In the GNU style, the "&&"s go at the start of the line.

I think this code should check for failures from PyLong_FromLong and
PyTuple_SetItem.  I realize that is a pain, but if one of those does
fail, a failure to check will yield weird problems.

Phil>  Return a type of pointer to this type." },
Phil> +  { "range", typy_range, METH_NOARGS,
Phil> +    "range () -> Tuple\n\

It should be "tuple", as that is the name of the returned type.

Tom



More information about the Gdb-patches mailing list