]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MAJOR: spoa/python: Fixing return None
authorGilchrist Dadaglo <dadaglo@amazon.com>
Tue, 8 Dec 2020 14:37:07 +0000 (14:37 +0000)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 9 Dec 2020 07:39:31 +0000 (08:39 +0100)
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.

contrib/spoa_server/ps_python.c

index 5cb7ca86e230be47feb13b9bf52de84f3593852a..81bb9325321475eb8d3fa38d07fb2906ba26e436 100644 (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;
 }