Re: [PATCH v2] [gdb/python] Convert valpy_call to the "python safety" approach

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

Tom> I added wrapper function gdbpy_tuple_check to wrap PyTuple_Check.  It always
Tom> succeeds, so strictly speaking it doesn't need a wrapper, but always using
Tom> wrapper functions and trusting them to DDRT is easier than remembering which
Tom> functions always succeed.

Seems reasonable.

Tom> I also added this template:
Tom> ...
Tom> template<typename T>
Tom> T
Tom> gdbpy_require_nonnull (T val)
Tom> {
Tom>   if (val == nullptr)
Tom>     throw gdb_python_exception ();
Tom>   return val;
Tom> }
Tom> ...
Tom> to do this simplification:

This also seems fine, though in the longer run we should be removing
this function again.

Tom> +gdbpy_ref<>
Tom> +value_object::valpy_call (gdbpy_borrowed_ref<> args,
Tom> +			  gdbpy_opt_borrowed_ref<> keywords ATTRIBUTE_UNUSED)

Not too sure about that ATTRIBUTE_UNUSED.
Like, if we don't need it, we should support a different signature
elsewhere.


Tom> +  safety_details::varargs_wrapper<value_object, &value_object::valpy_call>, /*tp_call*/

I think code outside py-safety.h should not refer to the contents of the
safety_details namespace.

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.