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.
diff --git a/contrib/spoa_server/ps_python.c b/contrib/spoa_server/ps_python.c
index 5cb7ca8..81bb932 100644
--- a/contrib/spoa_server/ps_python.c
+++ b/contrib/spoa_server/ps_python.c
@@ -90,7 +90,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
/* 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 @@
}
/* 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 @@
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 @@
PyErr_SetString(spoa_error, "No space left available");
return NULL;
}
- return Py_None;
+ Py_RETURN_NONE;
}