From aad98ffc0570bfb997047d2ec9a8aead725fc228 Mon Sep 17 00:00:00 2001 From: Milan Oberkirch | geOps Date: Wed, 21 Jan 2026 12:12:04 +0100 Subject: [PATCH] Create loop in `get_event_loop` if needed This fixes issue #702. --- uvloop/__init__.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/uvloop/__init__.py b/uvloop/__init__.py index 638b874c..ca906cf4 100644 --- a/uvloop/__init__.py +++ b/uvloop/__init__.py @@ -203,10 +203,7 @@ def get_event_loop(self) -> _AbstractEventLoop: Returns an instance of EventLoop or raises an exception. """ if self._local._loop is None: - raise RuntimeError( - 'There is no current event loop in thread %r.' - % threading.current_thread().name - ) + self._local._loop = self._loop_factory() return self._local._loop