[libvirt] [PATCH] Domain Events Python Bindings

Ben Guthro bguthro at virtualiron.com
Wed Oct 29 17:45:57 UTC 2008



Daniel Veillard wrote on 10/29/2008 01:09 PM:
>> +    /* Call the Callback Dispatcher */
>> +    pyobj_ret = PyObject_CallMethod(pyobj_conn_inst,
>> +                                    (char*)"dispatchDomainEventCallbacks",
>> +                                    (char*)"Oi",
>> +                                    pyobj_dom_inst,
>> +                                    event);
>> +
>> +    Py_DECREF(pyobj_dom_inst);
>> +    Py_DECREF(pyobj_conn_inst);
> 
>   We should make clear that the python callback can't keep any reference
> to the domain.
>   Maybe the solution is to pass a name or UUID string and let the python
> user do the lookup, might also avoid the object duplication (but then
> the user will do the dictionary of domains and get into the same
> problems of object lifetime).... I hate asynch interfaces :-)
> 

If the callback keeps a reference, then python will reference count it, and this will not get garbage collected until it gives up the last reference... am I misunderstanding something?




More information about the libvir-list mailing list