Re: [PATCH v2] python: add virDomainGetCPUStats python binding API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/21/2012 08:07 PM, Eric Blake wrote:
Maybe we need a wrapper:

int libvirt_boolUnwrap(PyObject *obj, bool *value) {
     int ret = PyObject_IsTrue(obj);
     if (ret<  0)
         return ret;
     *value = ret>  0;
     return 0;
}

and then callers become:

     if (libvirt_boolUnwrap(value,&temp->value.b)<  0)
         goto cleanup;


The libvirt_boolUnwrap is okay to be flexible like this, we still need the caller to check whether or not the value given from user python code is boolean argument, we need to do the data type checking in python C API
   before invoking the wrapper.

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]