[libvirt] [PATCH 2/2] python: return error if PyObject obj is NULL for unwrapper helper functions

Guannan Ren gren at redhat.com
Fri Sep 28 08:28:39 UTC 2012


On 09/27/2012 09:51 PM, Michal Privoznik wrote:
> On 26.09.2012 19:33, Guannan Ren wrote:
>> The result is indeterminate for NULL argument to python
>> functions as follows. It's better to return negative value in
>> these situations.
>>
>> PyObject_IsTrue will segfault if the argument is NULL
>> PyFloat_AsDouble(NULL) is -1.000000
>> PyLong_AsUnsignedLongLong(NULL) is 0.000000
>> ---
>>   python/typewrappers.c | 43 +++++++++++++++++++++++++++++++++++++++++--
>>   1 file changed, 41 insertions(+), 2 deletions(-)
> ACK
>
> Michal

     Thanks and pushed

     Guannan




More information about the libvir-list mailing list