This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 5/7] [python] API for macros: gdb.Objfile symtabs method.
- From: Matt Rice <ratmice at gmail dot com>
- To: pmuldoon at redhat dot com
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 1 Sep 2011 16:13:03 -0700
- Subject: Re: [PATCH 5/7] [python] API for macros: gdb.Objfile symtabs method.
- References: <1314198654-9008-1-git-send-email-ratmice@gmail.com> <1314198654-9008-6-git-send-email-ratmice@gmail.com> <m3fwkjt5cp.fsf@redhat.com>
On Tue, Aug 30, 2011 at 6:07 AM, Phil Muldoon <pmuldoon@redhat.com> wrote:
> matt rice <ratmice@gmail.com> writes:
>
> If there are no symtabs, why return an empty list? ?Would Py_None make
> more sense here. ?And same rules apply to returning a Tuple, too, as
> others.
>
the main reason here to return an empty list is just because things like
(gdb) py for i in None: print "foo"
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: 'NoneType' object is not iterable
Error while executing Python code.
thus you require an 'if' and python's if doesn't work as a one liner...
such as
(gdb) py for i in list(): print "foo"
(gdb)
If you would still like me to change it, no problem.