diff --git a/plugins/python/uwsgi_pymodule.c b/plugins/python/uwsgi_pymodule.c index d9bdb4a6..dedf916b 100644 --- a/plugins/python/uwsgi_pymodule.c +++ b/plugins/python/uwsgi_pymodule.c @@ -419,6 +419,7 @@ PyObject *py_uwsgi_register_rpc(PyObject * self, PyObject * args) { return NULL; } + Py_INCREF(func); if (uwsgi_register_rpc(name, 0, argc, func)) { return PyErr_Format(PyExc_ValueError, "unable to register rpc function"); @@ -454,6 +455,8 @@ PyObject *py_uwsgi_register_signal(PyObject * self, PyObject * args) { return NULL; } + Py_INCREF(handler); + if (uwsgi_register_signal(uwsgi_signal, signal_kind, handler, 0)) { return PyErr_Format(PyExc_ValueError, "unable to register signal"); }