Re: [PATCH] Use Python safety API in py-symbol.c

Tom Tromey <[email protected]>
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
>>>>> "Andrew" == Andrew Burgess <[email protected]> writes:

>> +/* Normally gdb requires that if a method accepts multiple arguments,
>> +   then it should also accept keywords.  However, there are some
>> +   exceptions to this rule.  These exceptions should use this wrapper.
>> +   This should be used sparingly.
>> +
>> +   A typical exception is something that takes an optional argument.
>> +   So, it may call PyArg_ParseTuple with "|s" or the like.

Andrew> Would it not be better to just update the function in question to accept
Andrew> keyword arguments?  I know some people dislike using them on single
Andrew> argument functions, but surely from the GDB side, supporting them is
Andrew> pretty cheap, then it's up to the user if they want to use them or not?

I didn't do it in this patch because it is (or eventually would be) a
policy change.

FWIW an additional drawback is that means that the argument name is also
now part of the API.

Anyway I don't mind doing it.  The drawbacks seem reasonably minor.

FWIW I count 32 such functions existing now, which is more than I
thought existed.  So I guess another option would be to just drop the
"sparingly" text.

Tom
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.