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 0793C158092 for ; Mon, 20 Sep 2021 05:37:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 25F56E092D; Mon, 20 Sep 2021 05:37:00 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 0CC7CE092D for ; Mon, 20 Sep 2021 05:37:00 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 02EA0342DB4 for ; Mon, 20 Sep 2021 05:36:59 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 49422CF for ; Mon, 20 Sep 2021 05:36:57 +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: <1632114527.631bedffe29124d693de3b539fc908d9feec1420.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: 631bedffe29124d693de3b539fc908d9feec1420 X-VCS-Branch: master Date: Mon, 20 Sep 2021 05:36:57 +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: d60a0861-edde-43c8-876c-0ede5dc5554c X-Archives-Hash: 4da735d49f188acb7b41429b1d2bd029 commit: 631bedffe29124d693de3b539fc908d9feec1420 Author: Zac Medico gentoo org> AuthorDate: Mon Sep 20 05:05:38 2021 +0000 Commit: Zac Medico gentoo org> CommitDate: Mon Sep 20 05:08:47 2021 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=631bedff _safe_loop: fix python3.10 DeprecationWarning DeprecationWarning: There is no current event loop Signed-off-by: Zac Medico gentoo.org> lib/portage/util/futures/_asyncio/__init__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/portage/util/futures/_asyncio/__init__.py b/lib/portage/util/futures/_asyncio/__init__.py index c1229528a..ccf800c66 100644 --- a/lib/portage/util/futures/_asyncio/__init__.py +++ b/lib/portage/util/futures/_asyncio/__init__.py @@ -280,10 +280,14 @@ def _safe_loop(): loop = _thread_weakrefs.loops[thread_key] except KeyError: try: - _real_asyncio.get_event_loop() + try: + _loop = _real_asyncio.get_running_loop() + except AttributeError: + _loop = _real_asyncio.get_event_loop() except RuntimeError: - _real_asyncio.set_event_loop(_real_asyncio.new_event_loop()) - loop = _thread_weakrefs.loops[thread_key] = _AsyncioEventLoop() + _loop = _real_asyncio.new_event_loop() + _real_asyncio.set_event_loop(_loop) + loop = _thread_weakrefs.loops[thread_key] = _AsyncioEventLoop(loop=_loop) if ( _thread_weakrefs.mainloop is None