Make the _safe_loop function return an AsyncioEventLoop instance,
so that the default asyncio event loop implementation will be used
in API consumer threads. This is possible because the underlying
asyncio.get_event_loop() function returns a new event loop for
each thread.

Bug: https://bugs.gentoo.org/758755
Signed-off-by: Zac Medico <zmed...@gentoo.org>
---
[PATCH v2] fixed _safe_loop function to return a new
AsyncioEventLoop per thread

 lib/portage/util/futures/_asyncio/__init__.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/portage/util/futures/_asyncio/__init__.py 
b/lib/portage/util/futures/_asyncio/__init__.py
index a902ad895..12013be00 100644
--- a/lib/portage/util/futures/_asyncio/__init__.py
+++ b/lib/portage/util/futures/_asyncio/__init__.py
@@ -34,7 +34,6 @@ import portage
 portage.proxy.lazyimport.lazyimport(globals(),
        'portage.util.futures.unix_events:_PortageEventLoopPolicy',
        'portage.util.futures:compat_coroutine@_compat_coroutine',
-       'portage.util._eventloop.EventLoop:EventLoop@_EventLoop',
 )
 from portage.util._eventloop.asyncio_event_loop import AsyncioEventLoop as 
_AsyncioEventLoop
 from portage.util._eventloop.global_event_loop import (
@@ -256,4 +255,4 @@ def _safe_loop():
        """
        if portage._internal_caller:
                return _global_event_loop()
-       return _EventLoop(main=False)
+       return _AsyncioEventLoop()
-- 
2.26.2


Reply via email to