summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Berg <bberg@redhat.com>2021-10-27 15:00:39 +0200
committerBenjamin Berg <benjamin@sipsolutions.net>2022-12-26 15:37:36 +0100
commitf861e8bc95352d7e9aafb3a43a2be22bb2006839 (patch)
tree4746359b903a8339bda9650538e61ba67d62a930
parentd104c6e9437061cdb93f2fd0956863c067c72eef (diff)
downloadpygobject-f861e8bc95352d7e9aafb3a43a2be22bb2006839.tar.gz
gimodule: Expose PyOS_setsig for asyncio eventloop
-rw-r--r--gi/_ossighelper.py1
-rw-r--r--gi/gimodule.c13
2 files changed, 14 insertions, 0 deletions
diff --git a/gi/_ossighelper.py b/gi/_ossighelper.py
index fba24e6d..fd1b4499 100644
--- a/gi/_ossighelper.py
+++ b/gi/_ossighelper.py
@@ -127,6 +127,7 @@ def wakeup_on_signal():
PyOS_getsig = _gi.pyos_getsig
+PyOS_setsig = _gi.pyos_setsig
# We save the signal pointer so we can detect if glib has changed the
# signal handler behind Python's back (GLib.unix_signal_add)
diff --git a/gi/gimodule.c b/gi/gimodule.c
index 36e7924e..8d0f31b8 100644
--- a/gi/gimodule.c
+++ b/gi/gimodule.c
@@ -2286,6 +2286,18 @@ _wrap_pyig_pyos_getsig (PyObject *self, PyObject *args)
}
static PyObject *
+_wrap_pyig_pyos_setsig (PyObject *self, PyObject *args)
+{
+ int sig_num;
+ PyObject *sig_handler;
+
+ if (!PyArg_ParseTuple (args, "iO!:pyos_setsig", &sig_num, &PyLong_Type, &sig_handler))
+ return NULL;
+
+ return PyLong_FromVoidPtr ((void *)(PyOS_setsig (sig_num, (PyOS_sighandler_t) PyLong_AsVoidPtr (sig_handler))));
+}
+
+static PyObject *
_wrap_pygobject_new_full (PyObject *self, PyObject *args)
{
PyObject *ptr_value, *long_value;
@@ -2323,6 +2335,7 @@ static PyMethodDef _gi_functions[] = {
{ "variant_type_from_string", (PyCFunction) _wrap_pyg_variant_type_from_string, METH_VARARGS },
{ "source_new", (PyCFunction) pygi_source_new, METH_NOARGS },
{ "pyos_getsig", (PyCFunction) _wrap_pyig_pyos_getsig, METH_VARARGS },
+ { "pyos_setsig", (PyCFunction) _wrap_pyig_pyos_setsig, METH_VARARGS },
{ "source_set_callback", (PyCFunction) pygi_source_set_callback, METH_VARARGS },
{ "io_channel_read", (PyCFunction) pyg_channel_read, METH_VARARGS },
{ "require_foreign", (PyCFunction) pygi_require_foreign, METH_VARARGS | METH_KEYWORDS },