Fix bug in removing an EventLoop
This commit is contained in:
@@ -1173,10 +1173,11 @@ cdef class _EventLoop:
|
||||
self.thisptr = new UnixEventLoop()
|
||||
|
||||
def __dealloc__(self):
|
||||
del self.thisptr
|
||||
self.remove()
|
||||
|
||||
def delete(self):
|
||||
cpdef remove(self) except +reraise_kj_exception:
|
||||
del self.thisptr
|
||||
self.thisptr = NULL
|
||||
|
||||
# cpdef evalLater(self, func):
|
||||
# Py_INCREF(func)
|
||||
@@ -1215,7 +1216,7 @@ DEFAULT_EVENT_LOOP = _EventLoop()
|
||||
def remove_event_loop():
|
||||
global DEFAULT_EVENT_LOOP
|
||||
|
||||
DEFAULT_EVENT_LOOP.delete()
|
||||
DEFAULT_EVENT_LOOP.remove()
|
||||
DEFAULT_EVENT_LOOP = None
|
||||
|
||||
cdef class _CallContext:
|
||||
|
||||
@@ -12,8 +12,7 @@ def example_client():
|
||||
cap = client.restore(test_capnp.TestSturdyRefObjectId.new_message(tag='testInterface'))
|
||||
cap = cap.cast_as(test_capnp.TestInterface)
|
||||
|
||||
remote = cap.foo(i=5)
|
||||
response = remote.wait()
|
||||
response = cap.foo(i=5).wait()
|
||||
|
||||
assert response.x == '125'
|
||||
c.close()
|
||||
|
||||
@@ -35,8 +35,8 @@ def test_simple_rpc(capability):
|
||||
|
||||
assert response.x == '125'
|
||||
|
||||
# def test_custom_event_loop(capability):
|
||||
# capnp.remove_event_loop()
|
||||
# capnp.DEFAULT_EVENT_LOOP = capnp._EventLoop()
|
||||
def test_custom_event_loop(capability):
|
||||
capnp.remove_event_loop()
|
||||
capnp.DEFAULT_EVENT_LOOP = capnp._EventLoop()
|
||||
|
||||
# test_simple_rpc(capability)
|
||||
test_simple_rpc(capability)
|
||||
Reference in New Issue
Block a user