From 15a6a04622848ce23d9df1a51eea3ab1a13f3f0d Mon Sep 17 00:00:00 2001 From: Lilly Rose Berner Date: Mon, 18 Apr 2022 12:22:53 +0200 Subject: [PATCH] [tasks] Fix Task.failed() only being True while error handler runs --- discord/ext/tasks/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/ext/tasks/__init__.py b/discord/ext/tasks/__init__.py index 93f6969b8..9179b2215 100644 --- a/discord/ext/tasks/__init__.py +++ b/discord/ext/tasks/__init__.py @@ -271,7 +271,6 @@ class Loop(Generic[LF]): self._is_being_cancelled = False self._current_loop = 0 self._stop_next_iteration = False - self._has_failed = False def __get__(self, obj: T, objtype: Type[T]) -> Loop[LF]: if obj is None: @@ -397,6 +396,7 @@ class Loop(Generic[LF]): if self._injected is not None: args = (self._injected, *args) + self._has_failed = False self._task = asyncio.create_task(self._loop(*args, **kwargs)) return self._task