patch 8.2.1883: compiler warnings when using Python
Problem: Compiler warnings when using Python.
Solution: Adjust PyCFunction to also have the second argument. Use "int"
return type for some functions. Insert "(void *)" to get rid of
the remaining warnings.
diff --git a/src/if_python3.c b/src/if_python3.c
index 495aed3..a51be29 100644
--- a/src/if_python3.c
+++ b/src/if_python3.c
@@ -1252,7 +1252,7 @@
#define BufferType_Check(obj) ((obj)->ob_base.ob_type == &BufferType)
static PyObject* BufferSubscript(PyObject *self, PyObject *idx);
-static Py_ssize_t BufferAsSubscript(PyObject *self, PyObject *idx, PyObject *val);
+static int BufferAsSubscript(PyObject *self, PyObject *idx, PyObject *val);
// Line range type - Implementation functions
// --------------------------------------
@@ -1260,8 +1260,8 @@
#define RangeType_Check(obj) ((obj)->ob_base.ob_type == &RangeType)
static PyObject* RangeSubscript(PyObject *self, PyObject *idx);
-static Py_ssize_t RangeAsItem(PyObject *, Py_ssize_t, PyObject *);
-static Py_ssize_t RangeAsSubscript(PyObject *self, PyObject *idx, PyObject *val);
+static int RangeAsItem(PyObject *, Py_ssize_t, PyObject *);
+static int RangeAsSubscript(PyObject *self, PyObject *idx, PyObject *val);
// Current objects type - Implementation functions
// -----------------------------------------------
@@ -1346,7 +1346,7 @@
}
}
- static Py_ssize_t
+ static int
BufferAsSubscript(PyObject *self, PyObject* idx, PyObject* val)
{
if (PyLong_Check(idx))
@@ -1418,7 +1418,7 @@
////////////////
- static Py_ssize_t
+ static int
RangeAsItem(PyObject *self, Py_ssize_t n, PyObject *val)
{
return RBAsItem(((RangeObject *)(self))->buf, n, val,
@@ -1461,7 +1461,7 @@
}
}
- static Py_ssize_t
+ static int
RangeAsSubscript(PyObject *self, PyObject *idx, PyObject *val)
{
if (PyLong_Check(idx))