From 100ac35c5d48303de6f4ad928145b00ded5e55bc Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Mon, 8 Aug 2022 08:51:48 +0200 Subject: [PATCH] Deprecated loop argument to timeout(). --- asgiref/timeout.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/asgiref/timeout.py b/asgiref/timeout.py index d3fbca8b..6e5086f4 100644 --- a/asgiref/timeout.py +++ b/asgiref/timeout.py @@ -7,6 +7,7 @@ import asyncio +import warnings from types import TracebackType from typing import Any, Optional, Type @@ -35,6 +36,10 @@ def __init__( self._timeout = timeout if loop is None: loop = asyncio.get_running_loop() + else: + warnings.warn( + """The loop argument to timeout() is deprecated.""", DeprecationWarning + ) self._loop = loop self._task = None # type: Optional[asyncio.Task[Any]] self._cancelled = False