[pygobject/benzea/gio-asyncio] fallback to SafeChildWatcher
- From: Benjamin Berg <bberg src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [pygobject/benzea/gio-asyncio] fallback to SafeChildWatcher
 
- Date: Wed, 17 Nov 2021 14:48:32 +0000 (UTC)
 
commit 21a6426dc35b4e4b18c955b8af8f5f785662dc9c
Author: Benjamin Berg <bberg redhat com>
Date:   Wed Nov 17 15:48:09 2021 +0100
    fallback to SafeChildWatcher
 gi/events.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/gi/events.py b/gi/events.py
index 0226be1b..189a687b 100644
--- a/gi/events.py
+++ b/gi/events.py
@@ -291,7 +291,11 @@ class GLibEventLoopPolicy(events.AbstractEventLoopPolicy):
     if sys.platform != 'win32':
         def get_child_watcher(self):
             if self._child_watcher is None:
-                self._child_watcher = asyncio.ThreadedChildWatcher()
+                try:
+                    self._child_watcher = asyncio.ThreadedChildWatcher()
+                except AttributeError:
+                    # ThreadedChildWatcher is new in 3.7
+                    self._child_watcher = asyncio.SafeChildWatcher()
                 if threading.current_thread() is threading.main_thread():
                     self._child_watcher.attach_loop(self.get_event_loop())
 
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]