diff options
author | Cole Robinson <crobinso@redhat.com> | 2011-06-15 20:02:27 -0400 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2011-06-21 10:08:48 -0400 |
commit | f2fb235b1d562a554f188bdbb8c0abca323bddbc (patch) | |
tree | e9854f6c590aac26d7ca241135df8c64e720a7f9 /examples | |
parent | python: Add bindings for virEvent*Handle/Timeout (diff) | |
download | libvirt-f2fb235b1d562a554f188bdbb8c0abca323bddbc.tar.gz libvirt-f2fb235b1d562a554f188bdbb8c0abca323bddbc.tar.bz2 libvirt-f2fb235b1d562a554f188bdbb8c0abca323bddbc.zip |
python: events: Fix C->Python handle callback prototype
If registering our own event loop implementation written in python,
any handles or timeouts callbacks registered by libvirt C code must
be wrapped in a python function. There is some argument trickery that
makes this all work, by wrapping the user passed opaque value in
a tuple, along with the callback function.
Problem is, the current setup requires the user's event loop to know
about this trickery, rather than just treating the opaque value
as truly opaque.
Fix this in a backwards compatible manner, and adjust the example
python event loop to do things the proper way.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/domain-events/events-python/event-test.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/examples/domain-events/events-python/event-test.py b/examples/domain-events/events-python/event-test.py index df75dce82..76fda2bb4 100644 --- a/examples/domain-events/events-python/event-test.py +++ b/examples/domain-events/events-python/event-test.py @@ -66,8 +66,7 @@ class virEventLoopPure: self.cb(self.handle, self.fd, events, - self.opaque[0], - self.opaque[1]) + self.opaque) # This class contains the data we need to track for a # single periodic timer @@ -96,8 +95,7 @@ class virEventLoopPure: def dispatch(self): self.cb(self.timer, - self.opaque[0], - self.opaque[1]) + self.opaque) def __init__(self): |