[pygobject/benzea/gio-asyncio] fixup! events: Implement asyncio event loop based on glib
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject/benzea/gio-asyncio] fixup! events: Implement asyncio event loop based on glib
- Date: Fri, 19 Nov 2021 09:10:00 +0000 (UTC)
commit 9d306ae62e5d8d3ae7450f5274e65b8ea9d2562b
Author: Benjamin Berg <bberg redhat com>
Date: Fri Nov 19 10:09:46 2021 +0100
fixup! events: Implement asyncio event loop based on glib
gi/events.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gi/events.py b/gi/events.py
index 8067cf05..36a6b6d2 100644
--- a/gi/events.py
+++ b/gi/events.py
@@ -246,7 +246,9 @@ class GLibEventLoopPolicy(events.AbstractEventLoopPolicy):
# return a new python wrapper. But, we can use hash() as that returns
# the pointer to the C structure.
try:
- return self._loops[ctx]
+ loop = self._loops[ctx]
+ if not loop.is_closed():
+ return loop
except KeyError:
pass
@@ -326,6 +328,8 @@ class _Source(GLib.Source):
def __init__(self, selector):
super().__init__()
+ self._dispatching = False
+
# It is *not* safe to run the *python* part of the mainloop recursively.
# (This is the default, but make it explicit.)
self.set_can_recurse(False)
@@ -403,7 +407,6 @@ class _Selector(selectors.BaseSelector):
self._context = context
self._loop = loop
- self._dispatching = False
self._fd_to_key = {}
self._source = _Source(self)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]