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, 20 Sep 2021 07:21:00 +0000 (UTC)	[thread overview]
Message-ID: <1632121642.2f474767eaf3b042bea31bc524281e0841cb271b.zmedico@gentoo> (raw)

commit:     2f474767eaf3b042bea31bc524281e0841cb271b
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 20 06:44:36 2021 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Sep 20 07:07:22 2021 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=2f474767

ExtendedFuture: Fix python3.10 DeprecationWarning

DeprecationWarning: There is no current event loop

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

 lib/portage/util/futures/extendedfutures.py | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/lib/portage/util/futures/extendedfutures.py b/lib/portage/util/futures/extendedfutures.py
index 6aa3ebbe8..c23feafb5 100644
--- a/lib/portage/util/futures/extendedfutures.py
+++ b/lib/portage/util/futures/extendedfutures.py
@@ -10,7 +10,13 @@ __all__ = (
     "InvalidStateError",
 )
 
-from portage.util.futures.futures import Future, InvalidStateError, CancelledError
+import concurrent.futures
+from concurrent.futures import Future, CancelledError
+
+try:
+    from concurrent.futures import InvalidStateError
+except ImportError:
+    from portage.util.futures.futures import InvalidStateError
 
 # Create our one time settable unset constant
 UNSET_CONST = Future()
@@ -62,9 +68,21 @@ class ExtendedFuture(Future):
             default = self.default_result
         if default is not UNSET_CONST.result():
             try:
-                data = super(ExtendedFuture, self).result()
+                data = self.result()
             except InvalidStateError:
                 data = default
         else:
-            data = super(ExtendedFuture, self).result()
+            data = self.result()
         return data
+
+    def exception(self):
+        try:
+            return super(ExtendedFuture, self).exception(timeout=0)
+        except concurrent.futures.TimeoutError:
+            raise InvalidStateError
+
+    def result(self):
+        try:
+            return super(ExtendedFuture, self).result(timeout=0)
+        except concurrent.futures.TimeoutError:
+            raise InvalidStateError


             reply	other threads:[~2021-09-20  7:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-20  7:21 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-03-07  8:11 [gentoo-commits] proj/portage:master commit in: lib/portage/util/futures/ 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
2020-08-17  4:24 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=1632121642.2f474767eaf3b042bea31bc524281e0841cb271b.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