aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2020-02-28 20:24:19 -0800
committerZac Medico <zmedico@gentoo.org>2020-02-28 20:31:50 -0800
commit64b11fe4dbcd7f2b4c36d8c40a09425a2c624c7a (patch)
treeaa58ef7daf577ea7e1e55e8d522a852ae6e3ed4f /lib
parentrepoman: Restore eclass deprecations lost in rewrite (diff)
downloadportage-64b11fe4dbcd7f2b4c36d8c40a09425a2c624c7a.tar.gz
portage-64b11fe4dbcd7f2b4c36d8c40a09425a2c624c7a.tar.bz2
portage-64b11fe4dbcd7f2b4c36d8c40a09425a2c624c7a.zip
asyncio: improve _AsyncioEventLoop isinstance logic
Since _AsyncioEventLoop can be wrapped, use the _asyncio_wrapper attributre for isinstance checks (_wrap_loop guarantees that this attribute exists). Signed-off-by: Zac Medico <zmedico@gentoo.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/portage/util/futures/_asyncio/__init__.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/portage/util/futures/_asyncio/__init__.py b/lib/portage/util/futures/_asyncio/__init__.py
index 7635dbb5e..f4b03891f 100644
--- a/lib/portage/util/futures/_asyncio/__init__.py
+++ b/lib/portage/util/futures/_asyncio/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 2018 Gentoo Foundation
+# Copyright 2018-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
__all__ = (
@@ -139,7 +139,7 @@ def create_subprocess_exec(*args, **kwargs):
"""
loop = _wrap_loop(kwargs.pop('loop', None))
kwargs.setdefault('close_fds', _close_fds_default)
- if _asyncio_enabled and isinstance(loop, _AsyncioEventLoop):
+ if _asyncio_enabled and isinstance(loop._asyncio_wrapper, _AsyncioEventLoop):
# Use the real asyncio create_subprocess_exec (loop argument
# is deprecated since since Python 3.8).
return _real_asyncio.create_subprocess_exec(*args, **kwargs)
@@ -191,10 +191,10 @@ def ensure_future(coro_or_future, loop=None):
@return: an instance of Future
"""
loop = _wrap_loop(loop)
- if _asyncio_enabled and isinstance(loop, _AsyncioEventLoop):
+ if _asyncio_enabled and isinstance(loop._asyncio_wrapper, _AsyncioEventLoop):
# Use the real asyncio loop and ensure_future.
return _real_asyncio.ensure_future(
- coro_or_future, loop=loop._loop)
+ coro_or_future, loop=loop._asyncio_wrapper._loop)
if isinstance(coro_or_future, Future):
return coro_or_future