]> git.ipfire.org Git - thirdparty/libvirt.git/commit
python: return error if PyObject obj is NULL for unwrapper helper functions
authorGuannan Ren <gren@redhat.com>
Wed, 26 Sep 2012 17:33:50 +0000 (01:33 +0800)
committerGuannan Ren <gren@redhat.com>
Fri, 28 Sep 2012 08:43:12 +0000 (16:43 +0800)
commit4c6be02a3e502027a819e20b6f5add8f63c20291
tree72ed84aaa7214c0420f669c7fa90b803e898f7b6
parentdb488c79173b240459c7754f38c3c6af9b432970
python: return error if PyObject obj is NULL for unwrapper helper functions

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