[pygobject/benzea/gio-asyncio: 1/2] gimodule: Expose PyOS_setsig for asyncio eventloop
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject/benzea/gio-asyncio: 1/2] gimodule: Expose PyOS_setsig for asyncio eventloop
- Date: Wed, 27 Oct 2021 15:11:54 +0000 (UTC)
commit e958ea3cef11ce7ba0cbd007269a8fddb48777a4
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 1501bd47..c17593e3 100644
--- a/gi/gimodule.c
+++ b/gi/gimodule.c
@@ -2271,6 +2271,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;
+ long sig_handler;
+
+ if (!PyArg_ParseTuple (args, "il:pyos_setsig", &sig_num, &sig_handler))
+ return NULL;
+
+ return PyLong_FromVoidPtr ((void *)(PyOS_setsig (sig_num, (PyOS_sighandler_t) sig_handler)));
+}
+
static PyObject *
_wrap_pygobject_new_full (PyObject *self, PyObject *args)
{
@@ -2309,6 +2321,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]