opentelemetry-python-contrib/reference/ddtrace/contrib/asyncio/compat.py

10 lines
304 B
Python

import sys
# asyncio.Task.current_task method is deprecated and will be removed in Python
# 3.9. Instead use asyncio.current_task
if sys.version_info >= (3, 7, 0):
from asyncio import current_task as asyncio_current_task
else:
import asyncio
asyncio_current_task = asyncio.Task.current_task