From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 11CC41382C5 for ; Mon, 7 May 2018 00:27:33 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 648E5E096B; Mon, 7 May 2018 00:27:32 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 4112EE096A for ; Mon, 7 May 2018 00:27:32 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 28E5E335C9B for ; Mon, 7 May 2018 00:27:31 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 1512442 for ; Mon, 7 May 2018 00:27:29 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1525652394.a1360e017b7ee8156ad4ad850e2f8ea40228ca1a.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/util/_eventloop/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/util/_eventloop/EventLoop.py X-VCS-Directories: pym/portage/util/_eventloop/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: a1360e017b7ee8156ad4ad850e2f8ea40228ca1a X-VCS-Branch: master Date: Mon, 7 May 2018 00:27:29 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 5b29ac56-7d26-42d5-8a12-cff5733f3934 X-Archives-Hash: 9cb7a1a39e8c2f26b8f3477256269d64 commit: a1360e017b7ee8156ad4ad850e2f8ea40228ca1a Author: Zac Medico gentoo org> AuthorDate: Mon May 7 00:06:07 2018 +0000 Commit: Zac Medico gentoo org> CommitDate: Mon May 7 00:19:54 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=a1360e01 EventLoop.run_in_executor: use asyncio.wrap_future Since executors from the concurrent.futures package return concurrent.futures.Future, it's necessary to wrap them. pym/portage/util/_eventloop/EventLoop.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pym/portage/util/_eventloop/EventLoop.py b/pym/portage/util/_eventloop/EventLoop.py index fc7380b03..de0795224 100644 --- a/pym/portage/util/_eventloop/EventLoop.py +++ b/pym/portage/util/_eventloop/EventLoop.py @@ -13,6 +13,11 @@ import signal import sys import traceback +try: + import asyncio as _real_asyncio +except ImportError: + _real_asyncio = None + try: import fcntl except ImportError: @@ -937,7 +942,11 @@ class EventLoop(object): if executor is None: executor = ForkExecutor(loop=self) self._default_executor = executor - return executor.submit(func, *args) + future = executor.submit(func, *args) + if _real_asyncio is not None: + future = _real_asyncio.wrap_future(future, + loop=self._asyncio_wrapper) + return future def is_running(self): """Return whether the event loop is currently running."""