Commit 248a49d7 authored by Denis Bilenko's avatar Denis Bilenko

core.pyx: add __enter__ and __exit__ to core.event

parent 551fff41
......@@ -198,6 +198,12 @@ cdef class event:
return '<%s flags=0x%x, handle=%s, callback=%s, arg=%s%s>' % \
(type(self).__name__, self.ev.ev_flags, self.ev.ev_fd, self._callback, self._arg, pending)
def __enter__(self):
return self
def __exit__(self, *exit_args):
self.cancel()
cdef class read(event):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment