[pygobject/benzea/gio-asyncio] more debugging
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject/benzea/gio-asyncio] more debugging
- Date: Mon, 22 Nov 2021 16:29:43 +0000 (UTC)
commit 0877081b7f11854e0c3411f4a2823d0b72b1c153
Author: Benjamin Berg <bberg redhat com>
Date: Mon Nov 22 17:28:37 2021 +0100
more debugging
gi/events.py | 11 +++++++++++
tests/test_events.py | 1 +
2 files changed, 12 insertions(+)
---
diff --git a/gi/events.py b/gi/events.py
index 45c142fa..f936bfe2 100644
--- a/gi/events.py
+++ b/gi/events.py
@@ -143,6 +143,8 @@ class GLibEventLoop(asyncio.SelectorEventLoop):
def add_signal_handler(self, sig, callback, *args):
"""Add a handler for UNIX signal"""
+ print(f"Adding signal handler for {sig}")
+
if (coroutines.iscoroutine(callback) or
coroutines.iscoroutinefunction(callback)):
raise TypeError("coroutines cannot be used "
@@ -158,6 +160,7 @@ class GLibEventLoop(asyncio.SelectorEventLoop):
# Pure python demands that there is only one signal handler
source, _, _ = self.__signal_handlers.get(sig, (None, None, None))
if source:
+ print("Destroying old source for signal")
source.destroy()
# Setup a new source with a higher priority than our main one
@@ -167,6 +170,7 @@ class GLibEventLoop(asyncio.SelectorEventLoop):
source.attach(self._context)
source.set_callback(self._signal_cb, sig)
+ print(f"add signal {sig} to loop {self}")
self.__signal_handlers[sig] = (source, callback, args)
del source
@@ -174,6 +178,8 @@ class GLibEventLoop(asyncio.SelectorEventLoop):
if sig not in {signal.SIGHUP, signal.SIGINT, signal.SIGTERM, signal.SIGUSR1, signal.SIGUSR2,
signal.SIGWINCH}:
return super().remove_signal_handler(sig)
+ print(f"removing signal {sig}")
+
try:
source, _, _ = self.__signal_handlers[sig]
del self.__signal_handlers[sig]
@@ -193,6 +199,7 @@ class GLibEventLoop(asyncio.SelectorEventLoop):
return False
def _signal_cb(self, sig):
+ print("received signal")
source, cb, args = self.__signal_handlers.get(sig)
# Pass over to python mainloop
@@ -283,6 +290,10 @@ class GLibEventLoopPolicy(events.AbstractEventLoopPolicy):
with the main thread using the default main context.
"""
+ import traceback
+ print("set_event_loop to", loop)
+ traceback.print_stack(limit=5, file=sys.stdout)
+
# Only accept glib event loops, otherwise things will just mess up
assert loop is None or isinstance(loop, GLibEventLoop)
diff --git a/tests/test_events.py b/tests/test_events.py
index d058535e..dde434da 100644
--- a/tests/test_events.py
+++ b/tests/test_events.py
@@ -134,6 +134,7 @@ if sys.platform != 'win32':
return
def test_run_until_complete(self):
+ print("noped out run-until-complete")
return
t0 = self.loop.time()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]