diff --git a/asyncpy/asyncpy/spider.py b/asyncpy/asyncpy/spider.py index 6032bc80f80a38b632f92a767f4a7b0ba3f41b93..761d8d5968d8bf375a8bc58aa31f239508a3118f 100755 --- a/asyncpy/asyncpy/spider.py +++ b/asyncpy/asyncpy/spider.py @@ -203,8 +203,8 @@ class Spider(SpiderHook): async def _cancel_tasks(self): tasks = [] - for task in asyncio.Task.all_tasks(): - if task is not asyncio.tasks.Task.current_task(): + for task in asyncio.all_tasks(): + if task is not asyncio.current_task(): tasks.append(task) task.cancel() await asyncio.gather(*tasks, return_exceptions=True)