[pygobject/benzea/gio-asyncio: 37/41] gimodule: Expose PyOS_setsig for asyncio eventloop




commit a12bf34ef1e700b86e1c3c993feb12bef1463422
Author: Benjamin Berg <bberg redhat com>
Date:   Wed Oct 27 15:00:39 2021 +0200

    gimodule: Expose PyOS_setsig for asyncio eventloop

 gi/_ossighelper.py |  1 +
 gi/gimodule.c      | 13 +++++++++++++
 2 files changed, 14 insertions(+)
---
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
@@ -2285,6 +2285,18 @@ _wrap_pyig_pyos_getsig (PyObject *self, PyObject *args)
     return PyLong_FromVoidPtr ((void *)(PyOS_getsig (sig_num)));
 }
 
+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)
 {
@@ -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 },


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]