summaryrefslogtreecommitdiffstats
path: root/Objects/rangeobject.c
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh.poyarekar@gmail.com>2018-04-29 18:59:33 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2018-04-29 18:59:33 (GMT)
commit55edd0c185ad2d895b5d73e47d67049bc156b654 (patch)
treed609dfc924b59b89816a610ba86cd3e6c34a641c /Objects/rangeobject.c
parent9f3535c9cde8813ce631d6ebe4d790682f594828 (diff)
downloadcpython-55edd0c185ad2d895b5d73e47d67049bc156b654.zip
cpython-55edd0c185ad2d895b5d73e47d67049bc156b654.tar.gz
cpython-55edd0c185ad2d895b5d73e47d67049bc156b654.tar.bz2
bpo-33012: Fix invalid function cast warnings with gcc 8 for METH_NOARGS. (GH-6030)
METH_NOARGS functions need only a single argument but they are cast into a PyCFunction, which takes two arguments. This triggers an invalid function cast warning in gcc8 due to the argument mismatch. Fix this by adding a dummy unused argument.
Diffstat (limited to 'Objects/rangeobject.c')
-rw-r--r--Objects/rangeobject.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c
index dd0e4be..28a244e 100644
--- a/Objects/rangeobject.c
+++ b/Objects/rangeobject.c
@@ -636,7 +636,7 @@ static PyNumberMethods range_as_number = {
};
static PyObject * range_iter(PyObject *seq);
-static PyObject * range_reverse(PyObject *seq);
+static PyObject * range_reverse(PyObject *seq, PyObject *Py_UNUSED(ignored));
PyDoc_STRVAR(reverse_doc,
"Return a reverse iterator.");
@@ -649,7 +649,7 @@ PyDoc_STRVAR(index_doc,
"Raise ValueError if the value is not present.");
static PyMethodDef range_methods[] = {
- {"__reversed__", (PyCFunction)range_reverse, METH_NOARGS, reverse_doc},
+ {"__reversed__", range_reverse, METH_NOARGS, reverse_doc},
{"__reduce__", (PyCFunction)range_reduce, METH_VARARGS},
{"count", (PyCFunction)range_count, METH_O, count_doc},
{"index", (PyCFunction)range_index, METH_O, index_doc},
@@ -731,7 +731,7 @@ rangeiter_next(rangeiterobject *r)
}
static PyObject *
-rangeiter_len(rangeiterobject *r)
+rangeiter_len(rangeiterobject *r, PyObject *Py_UNUSED(ignored))
{
return PyLong_FromLong(r->len - r->index);
}
@@ -740,7 +740,7 @@ PyDoc_STRVAR(length_hint_doc,
"Private method returning an estimate of len(list(it)).");
static PyObject *
-rangeiter_reduce(rangeiterobject *r)
+rangeiter_reduce(rangeiterobject *r, PyObject *Py_UNUSED(ignored))
{
PyObject *start=NULL, *stop=NULL, *step=NULL;
PyObject *range;
@@ -896,7 +896,7 @@ longrangeiter_len(longrangeiterobject *r, PyObject *no_args)
}
static PyObject *
-longrangeiter_reduce(longrangeiterobject *r)
+longrangeiter_reduce(longrangeiterobject *r, PyObject *Py_UNUSED(ignored))
{
PyObject *product, *stop=NULL;
PyObject *range;
@@ -1081,7 +1081,7 @@ range_iter(PyObject *seq)
}
static PyObject *
-range_reverse(PyObject *seq)
+range_reverse(PyObject *seq, PyObject *Py_UNUSED(ignored))
{
rangeobject *range = (rangeobject*) seq;
longrangeiterobject *it;