Skip to content

Commit 5b6496d

Browse files
committed
Complain when calling asyncio.get_event_loop()
from within Trio but without an active loop
1 parent e142699 commit 5b6496d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

trio_asyncio/loop.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ def _new_run_get():
125125
try:
126126
task = trio.hazmat.current_task()
127127
except RuntimeError:
128-
loop = None
128+
loop = _orig_run_get()
129129
else:
130130
loop = task.context.get(current_loop, None)
131+
if loop is None:
132+
raise RuntimeError("No trio_asyncio loop is active.")
131133

132-
if loop is None:
133-
loop = _orig_run_get()
134134
return loop
135135

136136

0 commit comments

Comments
 (0)