summaryrefslogtreecommitdiffstats
path: root/Modules/itertoolsmodule.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 /Modules/itertoolsmodule.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 'Modules/itertoolsmodule.c')
-rw-r--r--Modules/itertoolsmodule.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
index e0810c8..8a36755 100644
--- a/Modules/itertoolsmodule.c
+++ b/Modules/itertoolsmodule.c
@@ -138,7 +138,7 @@ groupby_next(groupbyobject *gbo)
}
static PyObject *
-groupby_reduce(groupbyobject *lz)
+groupby_reduce(groupbyobject *lz, PyObject *Py_UNUSED(ignored))
{
/* reduce as a 'new' call with an optional 'setstate' if groupby
* has started
@@ -320,7 +320,7 @@ _grouper_next(_grouperobject *igo)
}
static PyObject *
-_grouper_reduce(_grouperobject *lz)
+_grouper_reduce(_grouperobject *lz, PyObject *Py_UNUSED(ignored))
{
if (((groupbyobject *)lz->parent)->currgrouper != lz) {
return Py_BuildValue("N(())", _PyObject_GetBuiltin("iter"));
@@ -504,7 +504,7 @@ teedataobject_dealloc(teedataobject *tdo)
}
static PyObject *
-teedataobject_reduce(teedataobject *tdo)
+teedataobject_reduce(teedataobject *tdo, PyObject *Py_UNUSED(ignored))
{
int i;
/* create a temporary list of already iterated values */
@@ -649,7 +649,7 @@ tee_traverse(teeobject *to, visitproc visit, void *arg)
}
static PyObject *
-tee_copy(teeobject *to)
+tee_copy(teeobject *to, PyObject *Py_UNUSED(ignored))
{
teeobject *newto;
@@ -676,7 +676,7 @@ tee_fromiterable(PyObject *iterable)
if (it == NULL)
return NULL;
if (PyObject_TypeCheck(it, &tee_type)) {
- to = (teeobject *)tee_copy((teeobject *)it);
+ to = (teeobject *)tee_copy((teeobject *)it, NULL);
goto done;
}
@@ -726,7 +726,7 @@ tee_dealloc(teeobject *to)
}
static PyObject *
-tee_reduce(teeobject *to)
+tee_reduce(teeobject *to, PyObject *Py_UNUSED(ignored))
{
return Py_BuildValue("O(())(Oi)", Py_TYPE(to), to->dataobj, to->index);
}
@@ -973,7 +973,7 @@ cycle_next(cycleobject *lz)
}
static PyObject *
-cycle_reduce(cycleobject *lz)
+cycle_reduce(cycleobject *lz, PyObject *Py_UNUSED(ignored))
{
/* Create a new cycle with the iterator tuple, then set the saved state */
if (lz->it == NULL) {
@@ -1168,7 +1168,7 @@ dropwhile_next(dropwhileobject *lz)
}
static PyObject *
-dropwhile_reduce(dropwhileobject *lz)
+dropwhile_reduce(dropwhileobject *lz, PyObject *Py_UNUSED(ignored))
{
return Py_BuildValue("O(OO)l", Py_TYPE(lz), lz->func, lz->it, lz->start);
}
@@ -1332,7 +1332,7 @@ takewhile_next(takewhileobject *lz)
}
static PyObject *
-takewhile_reduce(takewhileobject *lz)
+takewhile_reduce(takewhileobject *lz, PyObject *Py_UNUSED(ignored))
{
return Py_BuildValue("O(OO)l", Py_TYPE(lz), lz->func, lz->it, lz->stop);
}
@@ -1558,7 +1558,7 @@ empty:
}
static PyObject *
-islice_reduce(isliceobject *lz)
+islice_reduce(isliceobject *lz, PyObject *Py_UNUSED(ignored))
{
/* When unpickled, generate a new object with the same bounds,
* then 'setstate' with the next and count
@@ -1746,7 +1746,7 @@ starmap_next(starmapobject *lz)
}
static PyObject *
-starmap_reduce(starmapobject *lz)
+starmap_reduce(starmapobject *lz, PyObject *Py_UNUSED(ignored))
{
/* Just pickle the iterator */
return Py_BuildValue("O(OO)", Py_TYPE(lz), lz->func, lz->it);
@@ -1918,7 +1918,7 @@ chain_next(chainobject *lz)
}
static PyObject *
-chain_reduce(chainobject *lz)
+chain_reduce(chainobject *lz, PyObject *Py_UNUSED(ignored))
{
if (lz->source) {
/* we can't pickle function objects (itertools.from_iterable) so
@@ -2242,7 +2242,7 @@ empty:
}
static PyObject *
-product_reduce(productobject *lz)
+product_reduce(productobject *lz, PyObject *Py_UNUSED(ignored))
{
if (lz->stopped) {
return Py_BuildValue("O(())", Py_TYPE(lz));
@@ -2569,7 +2569,7 @@ empty:
}
static PyObject *
-combinations_reduce(combinationsobject *lz)
+combinations_reduce(combinationsobject *lz, PyObject *Py_UNUSED(ignored))
{
if (lz->result == NULL) {
return Py_BuildValue("O(On)", Py_TYPE(lz), lz->pool, lz->r);
@@ -2903,7 +2903,7 @@ empty:
}
static PyObject *
-cwr_reduce(cwrobject *lz)
+cwr_reduce(cwrobject *lz, PyObject *Py_UNUSED(ignored))
{
if (lz->result == NULL) {
return Py_BuildValue("O(On)", Py_TYPE(lz), lz->pool, lz->r);
@@ -3262,7 +3262,7 @@ empty:
}
static PyObject *
-permutations_reduce(permutationsobject *po)
+permutations_reduce(permutationsobject *po, PyObject *Py_UNUSED(ignored))
{
if (po->result == NULL) {
return Py_BuildValue("O(On)", Py_TYPE(po), po->pool, po->r);
@@ -3514,7 +3514,7 @@ accumulate_next(accumulateobject *lz)
}
static PyObject *
-accumulate_reduce(accumulateobject *lz)
+accumulate_reduce(accumulateobject *lz, PyObject *Py_UNUSED(ignored))
{
if (lz->total == Py_None) {
PyObject *it;
@@ -3707,7 +3707,7 @@ compress_next(compressobject *lz)
}
static PyObject *
-compress_reduce(compressobject *lz)
+compress_reduce(compressobject *lz, PyObject *Py_UNUSED(ignored))
{
return Py_BuildValue("O(OO)", Py_TYPE(lz),
lz->data, lz->selectors);
@@ -3865,7 +3865,7 @@ filterfalse_next(filterfalseobject *lz)
}
static PyObject *
-filterfalse_reduce(filterfalseobject *lz)
+filterfalse_reduce(filterfalseobject *lz, PyObject *Py_UNUSED(ignored))
{
return Py_BuildValue("O(OO)", Py_TYPE(lz), lz->func, lz->it);
}
@@ -4108,7 +4108,7 @@ count_repr(countobject *lz)
}
static PyObject *
-count_reduce(countobject *lz)
+count_reduce(countobject *lz, PyObject *Py_UNUSED(ignored))
{
if (lz->cnt == PY_SSIZE_T_MAX)
return Py_BuildValue("O(OO)", Py_TYPE(lz), lz->long_cnt, lz->long_step);
@@ -4253,7 +4253,7 @@ repeat_repr(repeatobject *ro)
}
static PyObject *
-repeat_len(repeatobject *ro)
+repeat_len(repeatobject *ro, PyObject *Py_UNUSED(ignored))
{
if (ro->cnt == -1) {
PyErr_SetString(PyExc_TypeError, "len() of unsized object");
@@ -4265,7 +4265,7 @@ repeat_len(repeatobject *ro)
PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it)).");
static PyObject *
-repeat_reduce(repeatobject *ro)
+repeat_reduce(repeatobject *ro, PyObject *Py_UNUSED(ignored))
{
/* unpickle this so that a new repeat iterator is constructed with an
* object, then call __setstate__ on it to set cnt
@@ -4504,7 +4504,7 @@ zip_longest_next(ziplongestobject *lz)
}
static PyObject *
-zip_longest_reduce(ziplongestobject *lz)
+zip_longest_reduce(ziplongestobject *lz, PyObject *Py_UNUSED(ignored))
{
/* Create a new tuple with empty sequences where appropriate to pickle.