public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: lib/portage/util/futures/, lib/portage/util/_eventloop/, ...
@ 2024-10-28 22:03 Zac Medico
  0 siblings, 0 replies; only message in thread
From: Zac Medico @ 2024-10-28 22:03 UTC (permalink / raw
  To: gentoo-commits

commit:     69c8459835261b03af71c74ad75596c9425bcb0b
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 28 20:13:38 2024 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Oct 28 20:13:38 2024 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=69c84598

Handle python3.14 ChildWatcher changes

Bug: https://bugs.gentoo.org/941955
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 .../util/futures/asyncio/test_policy_wrapper_recursion.py   |  7 ++++---
 lib/portage/util/_eventloop/asyncio_event_loop.py           | 13 +++++++++----
 lib/portage/util/futures/unix_events.py                     |  8 ++------
 3 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/lib/portage/tests/util/futures/asyncio/test_policy_wrapper_recursion.py b/lib/portage/tests/util/futures/asyncio/test_policy_wrapper_recursion.py
index 3896f91acb..d22d0241ee 100644
--- a/lib/portage/tests/util/futures/asyncio/test_policy_wrapper_recursion.py
+++ b/lib/portage/tests/util/futures/asyncio/test_policy_wrapper_recursion.py
@@ -1,4 +1,4 @@
-# Copyright 2018 Gentoo Foundation
+# Copyright 2018-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 import asyncio
@@ -17,7 +17,8 @@ class PolicyWrapperRecursionTestCase(TestCase):
             with self.assertRaises(NotImplementedError):
                 asyncio.get_event_loop()
 
-            with self.assertRaises(NotImplementedError):
-                asyncio.get_child_watcher()
+            if hasattr(asyncio, "get_child_watcher"):
+                with self.assertRaises(NotImplementedError):
+                    asyncio.get_child_watcher()
         finally:
             asyncio.set_event_loop_policy(initial_policy)

diff --git a/lib/portage/util/_eventloop/asyncio_event_loop.py b/lib/portage/util/_eventloop/asyncio_event_loop.py
index c69e5c2f01..ad1dd387bf 100644
--- a/lib/portage/util/_eventloop/asyncio_event_loop.py
+++ b/lib/portage/util/_eventloop/asyncio_event_loop.py
@@ -6,12 +6,16 @@ import signal
 
 import asyncio as _real_asyncio
 from asyncio.events import AbstractEventLoop as _AbstractEventLoop
-from asyncio.unix_events import ThreadedChildWatcher
 
 try:
-    from asyncio.unix_events import PidfdChildWatcher
+    from asyncio.unix_events import _ThreadedChildWatcher as ThreadedChildWatcher
 except ImportError:
-    PidfdChildWatcher = None
+    from asyncio.unix_events import ThreadedChildWatcher
+
+try:
+    from asyncio.unix_events import _PidfdChildWatcher as PidfdChildWatcher
+except ImportError:
+    from asyncio.unix_events import PidfdChildWatcher
 
 import portage
 
@@ -123,7 +127,8 @@ class AsyncioEventLoop(_AbstractEventLoop):
             else:
                 watcher = ThreadedChildWatcher()
 
-            watcher.attach_loop(self._loop)
+            if hasattr(watcher, "attach_loop"):
+                watcher.attach_loop(self._loop)
             self._child_watcher = _ChildWatcherThreadSafetyWrapper(self, watcher)
 
         return self._child_watcher

diff --git a/lib/portage/util/futures/unix_events.py b/lib/portage/util/futures/unix_events.py
index 374497010c..370cafb001 100644
--- a/lib/portage/util/futures/unix_events.py
+++ b/lib/portage/util/futures/unix_events.py
@@ -1,14 +1,10 @@
-# Copyright 2018-2021 Gentoo Authors
+# Copyright 2018-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-__all__ = (
-    "AbstractChildWatcher",
-    "DefaultEventLoopPolicy",
-)
+__all__ = ("DefaultEventLoopPolicy",)
 
 import asyncio as _real_asyncio
 from asyncio import events
-from asyncio.unix_events import AbstractChildWatcher
 
 import fcntl
 import os


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-10-28 22:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-28 22:03 [gentoo-commits] proj/portage:master commit in: lib/portage/util/futures/, lib/portage/util/_eventloop/, Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox