diff --git a/uvloop/cbhandles.pyx b/uvloop/cbhandles.pyx index be05c6e..b93f558 100644 --- a/uvloop/cbhandles.pyx +++ b/uvloop/cbhandles.pyx @@ -57,18 +57,16 @@ cdef class Handle: callback(*args) elif cb_type == 2: - ((self.callback)[0])(self.arg1) + (self.callback)(self.arg1) elif cb_type == 3: - ((self.callback)[0])( - self.arg1, self.arg2) + (self.callback)(self.arg1, self.arg2) elif cb_type == 4: - ((self.callback)[0])( - self.arg1, self.arg2, self.arg3) + (self.callback)(self.arg1, self.arg2, self.arg3) elif cb_type == 5: - ((self.callback)[0])( + (self.callback)( self.arg1, self.arg2, self.arg3, self.arg4) else: @@ -130,7 +128,7 @@ cdef class TimerHandle: self._source_traceback = tb_extract_stack(sys_getframe(0)) self.timer = UVTimer.new( - loop, &self._run, self, delay) + loop, self._run, self, delay) self.timer.start() @@ -224,7 +222,7 @@ cdef new_Handle(Loop loop, object callback, object args): return handle -cdef new_MethodHandle(Loop loop, str name, method_t *callback, object ctx): +cdef new_MethodHandle(Loop loop, str name, method_t callback, object ctx): cdef Handle handle handle = Handle.__new__(Handle) handle._set_loop(loop) @@ -238,7 +236,7 @@ cdef new_MethodHandle(Loop loop, str name, method_t *callback, object ctx): return handle -cdef new_MethodHandle1(Loop loop, str name, method1_t *callback, +cdef new_MethodHandle1(Loop loop, str name, method1_t callback, object ctx, object arg): cdef Handle handle @@ -254,7 +252,7 @@ cdef new_MethodHandle1(Loop loop, str name, method1_t *callback, return handle -cdef new_MethodHandle2(Loop loop, str name, method2_t *callback, object ctx, +cdef new_MethodHandle2(Loop loop, str name, method2_t callback, object ctx, object arg1, object arg2): cdef Handle handle @@ -271,7 +269,7 @@ cdef new_MethodHandle2(Loop loop, str name, method2_t *callback, object ctx, return handle -cdef new_MethodHandle3(Loop loop, str name, method3_t *callback, object ctx, +cdef new_MethodHandle3(Loop loop, str name, method3_t callback, object ctx, object arg1, object arg2, object arg3): cdef Handle handle diff --git a/uvloop/handles/async_.pxd b/uvloop/handles/async_.pxd index 0f775b4..5f0d820 100644 --- a/uvloop/handles/async_.pxd +++ b/uvloop/handles/async_.pxd @@ -1,11 +1,11 @@ cdef class UVAsync(UVHandle): cdef: - method_t* callback + method_t callback object ctx - cdef _init(self, Loop loop, method_t* callback, object ctx) + cdef _init(self, Loop loop, method_t callback, object ctx) cdef send(self) @staticmethod - cdef UVAsync new(Loop loop, method_t* callback, object ctx) + cdef UVAsync new(Loop loop, method_t callback, object ctx) diff --git a/uvloop/handles/async_.pyx b/uvloop/handles/async_.pyx index 5457785..c1555ca 100644 --- a/uvloop/handles/async_.pyx +++ b/uvloop/handles/async_.pyx @@ -1,6 +1,6 @@ @cython.no_gc_clear cdef class UVAsync(UVHandle): - cdef _init(self, Loop loop, method_t* callback, object ctx): + cdef _init(self, Loop loop, method_t callback, object ctx): cdef int err self._start_init(loop) @@ -35,7 +35,7 @@ cdef class UVAsync(UVHandle): return @staticmethod - cdef UVAsync new(Loop loop, method_t* callback, object ctx): + cdef UVAsync new(Loop loop, method_t callback, object ctx): cdef UVAsync handle handle = UVAsync.__new__(UVAsync) handle._init(loop, callback, ctx) @@ -48,7 +48,7 @@ cdef void __uvasync_callback(uv.uv_async_t* handle) with gil: cdef: UVAsync async_ = handle.data - method_t cb = async_.callback[0] # deref + method_t cb = async_.callback try: cb(async_.ctx) except BaseException as ex: diff --git a/uvloop/handles/basetransport.pyx b/uvloop/handles/basetransport.pyx index 30be8f7..00cdf76 100644 --- a/uvloop/handles/basetransport.pyx +++ b/uvloop/handles/basetransport.pyx @@ -26,14 +26,14 @@ cdef class UVBaseTransport(UVSocketHandle): self._loop._call_soon_handle( new_MethodHandle(self._loop, "UVTransport._call_connection_made", - &self._call_connection_made, + self._call_connection_made, self)) cdef inline _schedule_call_connection_lost(self, exc): self._loop._call_soon_handle( new_MethodHandle1(self._loop, "UVTransport._call_connection_lost", - &self._call_connection_lost, + self._call_connection_lost, self, exc)) cdef _fatal_error(self, exc, throw, reason=None): @@ -139,7 +139,7 @@ cdef class UVBaseTransport(UVSocketHandle): self._loop._call_soon_handle( new_MethodHandle(self._loop, "UVTransport._start_reading", - &self._start_reading, + self._start_reading, self)) if self._waiter is not None: diff --git a/uvloop/handles/process.pyx b/uvloop/handles/process.pyx index 8925f73..d8c3107 100644 --- a/uvloop/handles/process.pyx +++ b/uvloop/handles/process.pyx @@ -533,7 +533,7 @@ cdef class UVProcessTransport(UVProcess): self._loop._call_soon_handle( new_MethodHandle1(self._loop, "UVProcessTransport._call_connection_made", - &self._call_connection_made, + self._call_connection_made, self, waiter)) @staticmethod @@ -567,7 +567,7 @@ cdef class UVProcessTransport(UVProcess): loop._call_soon_handle( new_MethodHandle1(loop, "UVProcessTransport._call_connection_made", - &handle._call_connection_made, + handle._call_connection_made, handle, waiter)) return handle diff --git a/uvloop/handles/timer.pxd b/uvloop/handles/timer.pxd index 4011149..e3ac4ea 100644 --- a/uvloop/handles/timer.pxd +++ b/uvloop/handles/timer.pxd @@ -1,16 +1,16 @@ cdef class UVTimer(UVHandle): cdef: - method_t* callback + method_t callback object ctx bint running uint64_t timeout - cdef _init(self, Loop loop, method_t* callback, object ctx, + cdef _init(self, Loop loop, method_t callback, object ctx, uint64_t timeout) cdef stop(self) cdef start(self) @staticmethod - cdef UVTimer new(Loop loop, method_t* callback, object ctx, + cdef UVTimer new(Loop loop, method_t callback, object ctx, uint64_t timeout) diff --git a/uvloop/handles/timer.pyx b/uvloop/handles/timer.pyx index 4a56c7a..36edca4 100644 --- a/uvloop/handles/timer.pyx +++ b/uvloop/handles/timer.pyx @@ -1,6 +1,6 @@ @cython.no_gc_clear cdef class UVTimer(UVHandle): - cdef _init(self, Loop loop, method_t* callback, object ctx, + cdef _init(self, Loop loop, method_t callback, object ctx, uint64_t timeout): cdef int err @@ -58,7 +58,7 @@ cdef class UVTimer(UVHandle): self.running = 1 @staticmethod - cdef UVTimer new(Loop loop, method_t* callback, object ctx, + cdef UVTimer new(Loop loop, method_t callback, object ctx, uint64_t timeout): cdef UVTimer handle @@ -73,7 +73,7 @@ cdef void __uvtimer_callback(uv.uv_timer_t* handle) with gil: cdef: UVTimer timer = handle.data - method_t cb = timer.callback[0] # deref + method_t cb = timer.callback timer.running = 0 try: diff --git a/uvloop/loop.pyx b/uvloop/loop.pyx index 54b01ae..b6d6190 100644 --- a/uvloop/loop.pyx +++ b/uvloop/loop.pyx @@ -140,23 +140,23 @@ cdef class Loop: self._ready_len = 0 self.handler_async = UVAsync.new( - self, &self._on_wake, self) + self, self._on_wake, self) self.handler_idle = UVIdle.new( self, new_MethodHandle( - self, "loop._on_idle", &self._on_idle, self)) + self, "loop._on_idle", self._on_idle, self)) self.handler_sigint = UVSignal.new( self, new_MethodHandle( - self, "loop._on_sigint", &self._on_sigint, self), + self, "loop._on_sigint", self._on_sigint, self), uv.SIGINT) self.handler_sighup = UVSignal.new( self, new_MethodHandle( - self, "loop._on_sighup", &self._on_sighup, self), + self, "loop._on_sighup", self._on_sighup, self), uv.SIGHUP) # Needed to call `UVStream._exec_write` for writes scheduled @@ -165,7 +165,7 @@ cdef class Loop: self, new_MethodHandle( self, "loop._exec_queued_writes", - &self._exec_queued_writes, self)) + self._exec_queued_writes, self)) uv.uv_disable_stdio_inheritance() @@ -662,7 +662,7 @@ cdef class Loop: handle = new_MethodHandle3( self, "Loop._sock_sendall", - &self._sock_sendall, + self._sock_sendall, self, fut, sock, data) @@ -709,7 +709,7 @@ cdef class Loop: handle = new_MethodHandle3( self, "Loop._sock_connect", - &self._sock_connect_cb, + self._sock_connect_cb, self, fut, sock, address) @@ -995,7 +995,7 @@ cdef class Loop: new_MethodHandle1( self, "Loop._stop", - &self._stop, + self._stop, self, None)) @@ -1784,7 +1784,7 @@ cdef class Loop: handle = new_MethodHandle3( self, "Loop._sock_recv", - &self._sock_recv, + self._sock_recv, self, fut, sock, n) @@ -1834,7 +1834,7 @@ cdef class Loop: handle = new_MethodHandle3( self, "Loop._sock_sendall", - &self._sock_sendall, + self._sock_sendall, self, fut, sock, data) @@ -1863,7 +1863,7 @@ cdef class Loop: handle = new_MethodHandle2( self, "Loop._sock_accept", - &self._sock_accept, + self._sock_accept, self, fut, sock) diff --git a/uvloop/task.pyx b/uvloop/task.pyx index 0508afc..a000415 100644 --- a/uvloop/task.pyx +++ b/uvloop/task.pyx @@ -21,7 +21,7 @@ cdef class BaseTask(BaseFuture): new_MethodHandle1( self._loop, "Task._step", - &self._fast_step, + self._fast_step, self, None)) @@ -46,7 +46,7 @@ cdef class BaseTask(BaseFuture): new_MethodHandle1( self._loop, "Task._step", - &self._fast_step, + self._fast_step, self, ex)) @@ -58,7 +58,7 @@ cdef class BaseTask(BaseFuture): new_MethodHandle1( self._loop, "Task._step", - &self._fast_step, + self._fast_step, self, ex)) @@ -70,7 +70,7 @@ cdef class BaseTask(BaseFuture): new_MethodHandle1( self._loop, "Task._step", - &self._fast_step, + self._fast_step, self, ex)) @@ -80,7 +80,7 @@ cdef class BaseTask(BaseFuture): new_MethodHandle1( self._loop, "Task._step", - &self._fast_step, + self._fast_step, self, ex)) @@ -89,7 +89,7 @@ cdef class BaseTask(BaseFuture): new_MethodHandle1( self._loop, "Task._step", - &self._fast_step, + self._fast_step, self, None))