File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -879,6 +879,19 @@ def test_get_ready_queue(self):
879879 l2 = len (self .loop .get_ready_queue ())
880880 self .assertEqual (l1 , l2 - 1 )
881881
882+ def test_ready_handle (self ):
883+ def cb (a , b ):
884+ return None
885+ args = 1 , 2
886+ self .loop .call_soon (cb , * args )
887+ handle = list (self .loop .get_ready_queue ())[- 1 ]
888+ self .assertIsInstance (handle , uvloop .loop .Handle )
889+ cb2 , args2 = handle .get_callback ()
890+ self .assertIs (cb , cb2 )
891+ self .assertEqual (args , args2 )
892+ #import uvloop.handles
893+ #self.assertIsInstance(last, uvloop.handles.Handle)
894+
882895
883896class TestBaseAIO (_TestBase , AIOTestCase ):
884897 pass
Original file line number Diff line number Diff line change @@ -161,6 +161,16 @@ cdef class Handle:
161161 def cancelled (self ):
162162 return self ._cancelled
163163
164+ def get_callback (self ):
165+ """
166+ Allow access to a python callback and its args.
167+ Return a (callback, args) tuple or None if it is an
168+ internal callback.
169+ """
170+ if self .cb_type == 1 :
171+ return self .arg1, self .arg2
172+ return None
173+
164174
165175@cython.no_gc_clear
166176@ cython.freelist (DEFAULT_FREELIST_SIZE)
You can’t perform that action at this time.
0 commit comments