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 5/7] [python] API for macros: gdb.Objfile symtabs method.


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

There's a precedent: gdb.Type.fields() returns an empty list if the type doesn't have fields.  I was wondering why that is, but your explanation gives the reason.

	paul


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