From 4feff50d7c968639aecb21b106c3b757184d3b95 Mon Sep 17 00:00:00 2001 From: Patrick Arminio Date: Tue, 6 Oct 2020 11:09:12 +0100 Subject: [PATCH] Fix get current task MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Python 3.9 has removed `asyncio.Task.current_task`, from the docs: > The asyncio.Task.current_task() and asyncio.Task.all_tasks() have been removed. They were deprecated since Python 3.7 and you can use asyncio.current_task() and asyncio.all_tasks() instead. (Contributed by RĂ©mi Lapeyre in bpo-40967) https://docs.python.org/3.9/whatsnew/3.9.html?highlight=current_task --- opentracing/scope_managers/asyncio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opentracing/scope_managers/asyncio.py b/opentracing/scope_managers/asyncio.py index c5ffb49..28a6fa4 100644 --- a/opentracing/scope_managers/asyncio.py +++ b/opentracing/scope_managers/asyncio.py @@ -107,7 +107,7 @@ def _get_task(self): except RuntimeError: return None - return asyncio.Task.current_task(loop=loop) + return asyncio.current_task(loop=loop) def _set_task_scope(self, scope, task=None): if task is None: