Skip to content

Commit

Permalink
Replace get_event_loop() with get_running_loop() for asyncio compatib…
Browse files Browse the repository at this point in the history
…ility (#211)

Signed-off-by: Tsuyoshi Hombashi <[email protected]>
  • Loading branch information
thombashi authored Dec 31, 2024
1 parent 82dd9e7 commit bdbdb8e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dominate/dom_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from collections import defaultdict, namedtuple
from functools import wraps
import threading
from asyncio import get_event_loop
from asyncio import get_running_loop
from uuid import uuid4
from contextvars import ContextVar

Expand Down Expand Up @@ -71,7 +71,7 @@ def _get_thread_context():
context.append(("greenlet", greenlet.getcurrent()))

try:
if get_event_loop().is_running():
if get_running_loop().is_running():
# Only add this extra information if we are actually in a running event loop
context.append(("async", _get_async_context_id()))
# A runtime error is raised if there is no async loop...
Expand Down

0 comments on commit bdbdb8e

Please sign in to comment.