Commit b1317788 authored by Yury Selivanov's avatar Yury Selivanov

asyncio.events: Use __slots__ in Handle and TimerHandle

parent 9887fd7a
...@@ -19,6 +19,8 @@ from .log import logger ...@@ -19,6 +19,8 @@ from .log import logger
class Handle: class Handle:
"""Object returned by callback registration methods.""" """Object returned by callback registration methods."""
__slots__ = ['_callback', '_args', '_cancelled']
def __init__(self, callback, args): def __init__(self, callback, args):
assert not isinstance(callback, Handle), 'A Handle is not a callback' assert not isinstance(callback, Handle), 'A Handle is not a callback'
self._callback = callback self._callback = callback
...@@ -46,6 +48,8 @@ class Handle: ...@@ -46,6 +48,8 @@ class Handle:
class TimerHandle(Handle): class TimerHandle(Handle):
"""Object returned by timed callback registration methods.""" """Object returned by timed callback registration methods."""
__slots__ = ['_when']
def __init__(self, when, callback, args): def __init__(self, when, callback, args):
assert when is not None assert when is not None
super().__init__(callback, args) super().__init__(callback, args)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment