Skip to content

Commit aad98ff

Browse files
committed
Create loop in get_event_loop if needed
This fixes issue #702.
1 parent 5910a18 commit aad98ff

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

uvloop/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,7 @@ def get_event_loop(self) -> _AbstractEventLoop:
203203
Returns an instance of EventLoop or raises an exception.
204204
"""
205205
if self._local._loop is None:
206-
raise RuntimeError(
207-
'There is no current event loop in thread %r.'
208-
% threading.current_thread().name
209-
)
206+
self._local._loop = self._loop_factory()
210207

211208
return self._local._loop
212209

0 commit comments

Comments
 (0)