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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 04EB3158083 for ; Sun, 1 Sep 2024 07:02:51 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 35CA42BC015; Sun, 1 Sep 2024 07:02:50 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 226EA2BC015 for ; Sun, 1 Sep 2024 07:02:50 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5D0EC3430BA for ; Sun, 1 Sep 2024 07:02:49 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 8D6131671 for ; Sun, 1 Sep 2024 07:02:47 +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: <1725173936.7f6b2b04878209130d44fc06105f521bae2b2173.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/util/futures/_asyncio/ X-VCS-Repository: proj/portage X-VCS-Files: lib/portage/util/futures/_asyncio/__init__.py X-VCS-Directories: lib/portage/util/futures/_asyncio/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 7f6b2b04878209130d44fc06105f521bae2b2173 X-VCS-Branch: master Date: Sun, 1 Sep 2024 07:02:47 +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-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: cff195bd-bea7-41ea-90f3-7804fd0bfd56 X-Archives-Hash: 8c24561a636576d0df032266dd2cf47a commit: 7f6b2b04878209130d44fc06105f521bae2b2173 Author: Zac Medico gentoo org> AuthorDate: Sat Aug 31 05:35:32 2024 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun Sep 1 06:58:56 2024 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=7f6b2b04 asyncio: Use default sleep implementation when possible When a loop argument is not given, use the default asyncio sleep implementation and avoid unnecessary _wrap_loop usage. Bug: https://bugs.gentoo.org/761538 Signed-off-by: Zac Medico gentoo.org> lib/portage/util/futures/_asyncio/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/portage/util/futures/_asyncio/__init__.py b/lib/portage/util/futures/_asyncio/__init__.py index 23c664e763..a235d87246 100644 --- a/lib/portage/util/futures/_asyncio/__init__.py +++ b/lib/portage/util/futures/_asyncio/__init__.py @@ -210,9 +210,12 @@ def sleep(delay, result=None, loop=None): @param result: result of the future @type loop: asyncio.AbstractEventLoop (or compatible) @param loop: event loop - @rtype: asyncio.Future (or compatible) - @return: an instance of Future + @rtype: collections.abc.Coroutine or asyncio.Future + @return: an instance of Coroutine or Future """ + if loop is None: + return _real_asyncio.sleep(delay, result=result) + loop = _wrap_loop(loop) future = loop.create_future() handle = loop.call_later(delay, future.set_result, result)