TaskContext now calls Task.__init__()

This commit is contained in:
Nocturn9x 2022-10-18 17:29:31 +02:00
parent f3ff5fcec5
commit ca1e8a157b
1 changed files with 3 additions and 5 deletions

View File

@ -28,8 +28,6 @@ class TaskContext(Task):
inside the event loop
"""
name: str = ""
def __init__(self) -> None:
"""
Object constructor
@ -39,10 +37,10 @@ class TaskContext(Task):
# includes any inner contexts contained within this
# one
self.tasks: list[Task | "TaskContext"] = []
self.name = object.__repr__(self)
# Whether we have been cancelled or not
self.cancelled: bool = False
super().__init__(f"TaskContext object at {hex(id(self))}", None)
async def spawn(
self, func: Callable[..., Coroutine[Any, Any, Any]], *args, **kwargs
) -> Task:
@ -111,4 +109,4 @@ class TaskContext(Task):
Implements repr(self)
"""
return object.__repr__(self)
return f"TaskContext({self.tasks})"