From cdbe9c82cc43c7ee08563347329c03cd557c8ca4 Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Mon, 13 Nov 2017 21:05:44 +0200 Subject: [PATCH] Provide to use uvloop --- aiogram/utils/context.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aiogram/utils/context.py b/aiogram/utils/context.py index 70c27b5b..2a846b23 100644 --- a/aiogram/utils/context.py +++ b/aiogram/utils/context.py @@ -21,7 +21,8 @@ def task_factory(loop: asyncio.BaseEventLoop, coro: typing.Coroutine): :rtype: :obj:`asyncio.Task` """ # Is not allowed when loop is closed. - loop._check_closed() + if loop.is_closed(): + raise RuntimeError('Event loop is closed.') task = asyncio.Task(coro, loop=loop)