@@ -13,7 +13,10 @@ def __init__(self):
13
13
def add_reader (self , fd , cb , * args ):
14
14
if __debug__ :
15
15
log .debug ("add_reader%s" , (fd , cb , args ))
16
- self .poller .register (fd , select .EPOLLIN | select .EPOLLONESHOT , (cb , args ))
16
+ if args :
17
+ self .poller .register (fd , select .EPOLLIN | select .EPOLLONESHOT , (cb , args ))
18
+ else :
19
+ self .poller .register (fd , select .EPOLLIN | select .EPOLLONESHOT , cb )
17
20
18
21
def remove_reader (self , fd ):
19
22
if __debug__ :
@@ -23,7 +26,10 @@ def remove_reader(self, fd):
23
26
def add_writer (self , fd , cb , * args ):
24
27
if __debug__ :
25
28
log .debug ("add_writer%s" , (fd , cb , args ))
26
- self .poller .register (fd , select .EPOLLOUT | select .EPOLLONESHOT , (cb , args ))
29
+ if args :
30
+ self .poller .register (fd , select .EPOLLOUT | select .EPOLLONESHOT , (cb , args ))
31
+ else :
32
+ self .poller .register (fd , select .EPOLLOUT | select .EPOLLONESHOT , cb )
27
33
28
34
def remove_writer (self , fd ):
29
35
if __debug__ :
@@ -48,8 +54,11 @@ def wait(self, delay):
48
54
#log.debug("epoll result: %s", res)
49
55
for cb , ev in res :
50
56
if __debug__ :
51
- log .debug ("Calling IO callback: %s%s" , cb [0 ], cb [1 ])
52
- cb [0 ](* cb [1 ])
57
+ log .debug ("Calling IO callback: %r" , cb )
58
+ if isinstance (cb , tuple ):
59
+ cb [0 ](* cb [1 ])
60
+ else :
61
+ cb ()
53
62
54
63
55
64
class StreamReader :
0 commit comments