[libvirt] [PATCH] fix python events

David Lively dlively at virtualiron.com
Thu Nov 20 22:04:49 UTC 2008


This patch gets python events working again after upstream changes, and
make the test implementation properly clean up after itself and
implement the new EventImpl API properly.

Note that the Python RemoveHandle and RemoveTimeout implementations
should return the opaque object registered by the corresponding
AddHandle/Timeout calls, in lieu of calling the (C) freefunc.  (The
binding code will then call freefunc if it's not NULL.)  Ignoring this
means you'll leak memory in the same way that C RemoveHandle/Timeout
leak if they don't (now) call the freefunc.

I also moved around some of the error checking code to unclutter (and
speed up) the common code paths.  For instance, we now check that the
virRegisterEventImpl arguments are callable just once (and return
failure if they're not), rather than checking them before every call and
blithely ignoring them if they're not callable.

Dave



 examples/domain-events/events-python/event-test.py |   29 +--
 python/libvir.c                                    |  200+++++++++++++++----
 python/libvir.py                                   |    4 
 python/libvirt_wrap.h                              |    8 
 python/types.c                                     |    1 
 python/virConnect.py                               |    4 
 6 files changed, 194 insertions(+), 52 deletions(-)




More information about the libvir-list mailing list