asyncio: Tulip issue 112: Inline make_handle() into Handle constructor

This commit is contained in:
Victor Stinner 2014-02-10 00:45:44 +01:00
parent 136fea253e
commit dc62b7e261
6 changed files with 9 additions and 14 deletions

View file

@ -20,6 +20,7 @@ class Handle:
"""Object returned by callback registration methods."""
def __init__(self, callback, args):
assert not isinstance(callback, Handle), 'A Handle is not a callback'
self._callback = callback
self._args = args
self._cancelled = False
@ -42,12 +43,6 @@ class Handle:
self = None # Needed to break cycles when an exception occurs.
def make_handle(callback, args):
# TODO: Inline this? Or make it a private EventLoop method?
assert not isinstance(callback, Handle), 'A Handle is not a callback'
return Handle(callback, args)
class TimerHandle(Handle):
"""Object returned by timed callback registration methods."""