Re: [PATCH] Added python binding for the new network events API

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

 



On 11/29/2013 08:27 AM, Cédric Bosdonnat wrote:
> This patch was extracted from the network events feature patch to fit the
> new libvirt-python repository.

Thanks for remembering this.  In the future, if you will do a one-time:

 git config format.subjectprefix "python PATCH"

then it will be more obvious which repo your patch applies to.


> +
> +    def networkEventDeregisterAny(self, callbackID):
> +        """Removes a Network Event Callback. De-registering for a
> +           network callback will disable delivery of this event type """

Trailing space inside the doc text looks odd

> +libvirt_virConnectNetworkEventLifecycleCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
> +                                               virNetworkPtr net,
> +                                               int event,
> +                                               void *opaque)
> +{
> +    PyObject *pyobj_cbData = (PyObject*)opaque;
> +    PyObject *pyobj_net;
> +    PyObject *pyobj_ret;
> +    PyObject *pyobj_conn;
> +    PyObject *dictKey;
> +    int ret = -1;
> +
> +    LIBVIRT_ENSURE_THREAD_STATE;
> +
> +    /* Create a python instance of this virNetworkPtr */
> +    virNetworkRef(net);
> +    pyobj_net = libvirt_virNetworkPtrWrap(net);
> +    Py_INCREF(pyobj_cbData);
> +
> +    dictKey = libvirt_constcharPtrWrap("conn");
> +    pyobj_conn = PyDict_GetItem(pyobj_cbData, dictKey);

Copy and paste, but can't dictKey be NULL if libvirt_constcharPtrWrap()
hit an OOM error, in which case PyDict_GetItem() will crash?


> +static PyObject *
> +libvirt_virConnectNetworkEventRegisterAny(ATTRIBUTE_UNUSED PyObject * self,
> +                                         PyObject * args)

Style: We put the * flush with the variable name, and usually place
attributes after rather than before:

(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)


-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
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]