From 68d60a999abb58219d659b4d4ed7f39eb47e7a08 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Tue, 13 Mar 2018 10:58:57 +0200 Subject: [PATCH] Bump to 2.0.1 --- CHANGES.rst | 6 ++++++ async_timeout/__init__.py | 11 +++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index be6a243..17f3e21 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,12 @@ CHANGES ======= +2.0.1 (2018-03-13) +------------------ + +* Fix ``PendingDeprecationWarning`` on Python 3.7 (#33) + + 2.0.0 (2017-10-09) ------------------ diff --git a/async_timeout/__init__.py b/async_timeout/__init__.py index 5a560f8..fc621c6 100644 --- a/async_timeout/__init__.py +++ b/async_timeout/__init__.py @@ -1,7 +1,10 @@ import asyncio +import sys -__version__ = '2.0.0' +__version__ = '2.0.1' + +PY_37 = sys.version_info >= (3, 7) class timeout: @@ -89,8 +92,12 @@ def _cancel_task(self): def current_task(loop): - task = asyncio.Task.current_task(loop=loop) + if PY_37: + task = asyncio.current_task(loop=loop) + else: + task = asyncio.Task.current_task(loop=loop) if task is None: + # this should be removed, tokio must use register_task and family API if hasattr(loop, 'current_task'): task = loop.current_task()