BUG/MAJOR: spoa/python: Fixing return None

As per https://docs.python.org/3/c-api/none.html, None requires to be
incremented before being returned to prevent deallocating none

This patch must be backported as far as 2.0.
This commit is contained in:
Gilchrist Dadaglo 2020-12-08 14:37:07 +00:00 committed by Christopher Faulet
parent 29885f0308
commit d5c428e761

View File

@ -90,7 +90,7 @@ static PyObject *ps_python_register_message(PyObject *self, PyObject *args)
ps_register_message(&ps_python_bindings, name, (void *)ref);
return Py_None;
Py_RETURN_NONE;
}
static PyObject *ps_python_set_var_null(PyObject *self, PyObject *args)
@ -109,7 +109,7 @@ static PyObject *ps_python_set_var_null(PyObject *self, PyObject *args)
PyErr_SetString(spoa_error, "No space left available");
return NULL;
}
return Py_None;
Py_RETURN_NONE;
}
static PyObject *ps_python_set_var_boolean(PyObject *self, PyObject *args)
@ -129,7 +129,7 @@ static PyObject *ps_python_set_var_boolean(PyObject *self, PyObject *args)
PyErr_SetString(spoa_error, "No space left available");
return NULL;
}
return Py_None;
Py_RETURN_NONE;
}
static PyObject *ps_python_set_var_int32(PyObject *self, PyObject *args)
@ -149,7 +149,7 @@ static PyObject *ps_python_set_var_int32(PyObject *self, PyObject *args)
PyErr_SetString(spoa_error, "No space left available");
return NULL;
}
return Py_None;
Py_RETURN_NONE;
}
static PyObject *ps_python_set_var_uint32(PyObject *self, PyObject *args)
@ -169,7 +169,7 @@ static PyObject *ps_python_set_var_uint32(PyObject *self, PyObject *args)
PyErr_SetString(spoa_error, "No space left available");
return NULL;
}
return Py_None;
Py_RETURN_NONE;
}
static PyObject *ps_python_set_var_int64(PyObject *self, PyObject *args)
@ -189,7 +189,7 @@ static PyObject *ps_python_set_var_int64(PyObject *self, PyObject *args)
PyErr_SetString(spoa_error, "No space left available");
return NULL;
}
return Py_None;
Py_RETURN_NONE;
}
static PyObject *ps_python_set_var_uint64(PyObject *self, PyObject *args)
@ -209,7 +209,7 @@ static PyObject *ps_python_set_var_uint64(PyObject *self, PyObject *args)
PyErr_SetString(spoa_error, "No space left available");
return NULL;
}
return Py_None;
Py_RETURN_NONE;
}
static PyObject *ps_python_set_var_ipv4(PyObject *self, PyObject *args)
@ -246,7 +246,7 @@ static PyObject *ps_python_set_var_ipv4(PyObject *self, PyObject *args)
}
/* Once we set the IP value in the worker, we don't need it anymore... */
Py_XDECREF(value);
return Py_None;
Py_RETURN_NONE;
}
static PyObject *ps_python_set_var_ipv6(PyObject *self, PyObject *args)
@ -283,7 +283,7 @@ static PyObject *ps_python_set_var_ipv6(PyObject *self, PyObject *args)
}
/* Once we set the IP value in the worker, we don't need it anymore... */
Py_XDECREF(value);
return Py_None;
Py_RETURN_NONE;
}
static PyObject *ps_python_set_var_str(PyObject *self, PyObject *args)
@ -306,7 +306,7 @@ static PyObject *ps_python_set_var_str(PyObject *self, PyObject *args)
PyErr_SetString(spoa_error, "No space left available");
return NULL;
}
return Py_None;
Py_RETURN_NONE;
}
static PyObject *ps_python_set_var_bin(PyObject *self, PyObject *args)
@ -329,7 +329,7 @@ static PyObject *ps_python_set_var_bin(PyObject *self, PyObject *args)
PyErr_SetString(spoa_error, "No space left available");
return NULL;
}
return Py_None;
Py_RETURN_NONE;
}