From 4e7ff8b1a31ae9c11164940d4171df13b9c1e277 Mon Sep 17 00:00:00 2001 From: Mariatta Wijaya Date: Mon, 6 Feb 2017 22:03:00 -0800 Subject: [PATCH] Issue #29314: Set the stacklevel to two in asyncio.async() Deprecation Warning --- Lib/asyncio/tasks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py index 8852aa5ad2a..7b3bdb21865 100644 --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -535,7 +535,8 @@ def async_(coro_or_future, *, loop=None): """ warnings.warn("asyncio.async() function is deprecated, use ensure_future()", - DeprecationWarning) + DeprecationWarning, + stacklevel=2) return ensure_future(coro_or_future, loop=loop)