public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/util/futures/
Date: Mon, 17 Aug 2020 04:24:20 +0000 (UTC)	[thread overview]
Message-ID: <1597638229.4db210cf165f426f695ecf8307942a2610b352fc.zmedico@gentoo> (raw)

commit:     4db210cf165f426f695ecf8307942a2610b352fc
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 17 04:20:22 2020 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Aug 17 04:23:49 2020 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=4db210cf

async_iter_completed: check if loop is closed in finally clause

This avoids RuntimeError('Event loop is closed') errors triggered
by SIGINT.

Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 lib/portage/util/futures/iter_completed.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/portage/util/futures/iter_completed.py b/lib/portage/util/futures/iter_completed.py
index 9554b4338..3c1a58e7e 100644
--- a/lib/portage/util/futures/iter_completed.py
+++ b/lib/portage/util/futures/iter_completed.py
@@ -107,8 +107,9 @@ def async_iter_completed(futures, max_jobs=None, max_load=None, loop=None):
 			yield future_done_set
 	finally:
 		# cleanup in case of interruption by SIGINT, etc
-		scheduler.cancel()
-		scheduler.wait()
+		if not loop.is_closed():
+			scheduler.cancel()
+			scheduler.wait()
 
 
 def iter_gather(futures, max_jobs=None, max_load=None, loop=None):


             reply	other threads:[~2020-08-17  4:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-17  4:24 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-09-20  7:21 [gentoo-commits] proj/portage:master commit in: lib/portage/util/futures/ Zac Medico
2021-03-07  8:11 Zac Medico
2021-03-07  7:41 Zac Medico
2021-03-07  7:31 Zac Medico
2021-03-07  7:13 Zac Medico
2021-01-18 12:20 Zac Medico
2021-01-04  9:00 Zac Medico
2020-08-24  3:40 Zac Medico
2019-02-16 17:38 Robin H. Johnson
2018-11-20 10:28 Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1597638229.4db210cf165f426f695ecf8307942a2610b352fc.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox