Removed needless cb closure.

This commit is contained in:
Ryan Williams
2010-02-22 17:52:07 -05:00
parent a1a93f8e53
commit c4084ada67

View File

@@ -111,15 +111,13 @@ def trampoline(fd, read=None, write=None, timeout=None,
assert hub.greenlet is not current, 'do not call blocking functions from the mainloop' assert hub.greenlet is not current, 'do not call blocking functions from the mainloop'
assert not (read and write), 'not allowed to trampoline for reading and writing' assert not (read and write), 'not allowed to trampoline for reading and writing'
fileno = getattr(fd, 'fileno', lambda: fd)() fileno = getattr(fd, 'fileno', lambda: fd)()
def cb(d):
current.switch()
if timeout is not None: if timeout is not None:
t = hub.schedule_call_global(timeout, current.throw, timeout_exc) t = hub.schedule_call_global(timeout, current.throw, timeout_exc)
try: try:
if read: if read:
listener = hub.add(hub.READ, fileno, cb) listener = hub.add(hub.READ, fileno, current.switch)
if write: elif write:
listener = hub.add(hub.WRITE, fileno, cb) listener = hub.add(hub.WRITE, fileno, current.switch)
try: try:
return hub.switch() return hub.switch()
finally: finally: