File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 11UNRELEASED
22----------
33
4+ * The ``loop`` argument to ``asgiref.timeout.timeout`` is deprecated. As per other
5+ ``asyncio`` based APIs, the running event loop is used by default. Note that
6+ ``asyncio`` provides timeout utilities from Python 3.11, and these should be
7+ preferred where available.
8+
49* Support for the ``ASGI_THREADS`` environment variable, used by
510 ``SyncToAsync``, is removed. In general, a running event-loop is not
611 available to `asgiref` at import time, and so the default thread pool
Original file line number Diff line number Diff line change 77
88
99import asyncio
10+ import warnings
1011from types import TracebackType
1112from typing import Any # noqa
1213from typing import Optional , Type
@@ -35,7 +36,11 @@ def __init__(
3536 ) -> None :
3637 self ._timeout = timeout
3738 if loop is None :
38- loop = asyncio .get_event_loop ()
39+ loop = asyncio .get_running_loop ()
40+ else :
41+ warnings .warn (
42+ """The loop argument to timeout() is deprecated.""" , DeprecationWarning
43+ )
3944 self ._loop = loop
4045 self ._task = None # type: Optional[asyncio.Task[Any]]
4146 self ._cancelled = False
You can’t perform that action at this time.
0 commit comments