From 304d68dd90d7030185b74b5444b2fc4d70e810af Mon Sep 17 00:00:00 2001 From: Fabrice Bauzac Date: Wed, 23 Oct 2019 21:33:54 +0200 Subject: [PATCH] Move from asyncio.Task.current_task() to asyncio.current_task() asyncio.Task.current_task() is deprecated, and generates lots of warnings in the pytests. --- opentracing/scope_managers/asyncio.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opentracing/scope_managers/asyncio.py b/opentracing/scope_managers/asyncio.py index c5ffb49..8be9d58 100644 --- a/opentracing/scope_managers/asyncio.py +++ b/opentracing/scope_managers/asyncio.py @@ -31,7 +31,7 @@ class AsyncioScopeManager(ThreadLocalScopeManager): """ :class:`~opentracing.ScopeManager` implementation for **asyncio** that stores the :class:`~opentracing.Scope` in the current - :class:`Task` (:meth:`Task.current_task()`), falling back to + :class:`Task` (:meth:`asyncio.current_task()`), falling back to thread-local storage if none was being executed. Automatic :class:`~opentracing.Span` propagation from @@ -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: