File tree 2 files changed +23
-0
lines changed
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):
879
879
l2 = len (self .loop .get_ready_queue ())
880
880
self .assertEqual (l1 , l2 - 1 )
881
881
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
+
882
895
883
896
class TestBaseAIO (_TestBase , AIOTestCase ):
884
897
pass
Original file line number Diff line number Diff line change @@ -161,6 +161,16 @@ cdef class Handle:
161
161
def cancelled (self ):
162
162
return self ._cancelled
163
163
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
+
164
174
165
175
@cython.no_gc_clear
166
176
@ cython.freelist (DEFAULT_FREELIST_SIZE)
You can’t perform that action at this time.
0 commit comments