Re: [PATCH 05/28] py-cmd.c error-checking bug fix

Tom Tromey
2013-05-15T16:20:50Z

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> On 04/19/2013 03:29 PM, Tom Tromey wrote:
>> diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
>> index 3da9960..ca9e415 100644
>> --- a/gdb/python/py-cmd.c
>> +++ b/gdb/python/py-cmd.c
>> @@ -668,6 +668,8 @@ gdbpy_string_to_argv (PyObject *self, PyObject *args)
>> return NULL;
>>
>> py_argv = PyList_New (0);
>> + if (py_argv == NULL)
>> + return NULL;
>>

Pedro> Shouldn't this be 'malloc_failure (0)' instead of returning NULL?

In the Python layer we follow Python conventions for error handling.
Here, PyList_New failed and set the Python exception.
We just propagate that to our caller.

Tom