mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
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.
This commit is contained in:
parent
9f3535c9cd
commit
55edd0c185
56 changed files with 406 additions and 406 deletions
|
@ -2590,7 +2590,7 @@ delta_getstate(PyDateTime_Delta *self)
|
|||
}
|
||||
|
||||
static PyObject *
|
||||
delta_total_seconds(PyObject *self)
|
||||
delta_total_seconds(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
PyObject *total_seconds;
|
||||
PyObject *total_microseconds;
|
||||
|
@ -2606,7 +2606,7 @@ delta_total_seconds(PyObject *self)
|
|||
}
|
||||
|
||||
static PyObject *
|
||||
delta_reduce(PyDateTime_Delta* self)
|
||||
delta_reduce(PyDateTime_Delta* self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return Py_BuildValue("ON", Py_TYPE(self), delta_getstate(self));
|
||||
}
|
||||
|
@ -2627,7 +2627,7 @@ static PyMemberDef delta_members[] = {
|
|||
};
|
||||
|
||||
static PyMethodDef delta_methods[] = {
|
||||
{"total_seconds", (PyCFunction)delta_total_seconds, METH_NOARGS,
|
||||
{"total_seconds", delta_total_seconds, METH_NOARGS,
|
||||
PyDoc_STR("Total seconds in the duration.")},
|
||||
|
||||
{"__reduce__", (PyCFunction)delta_reduce, METH_NOARGS,
|
||||
|
@ -2991,7 +2991,7 @@ date_repr(PyDateTime_Date *self)
|
|||
}
|
||||
|
||||
static PyObject *
|
||||
date_isoformat(PyDateTime_Date *self)
|
||||
date_isoformat(PyDateTime_Date *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return PyUnicode_FromFormat("%04d-%02d-%02d",
|
||||
GET_YEAR(self), GET_MONTH(self), GET_DAY(self));
|
||||
|
@ -3006,7 +3006,7 @@ date_str(PyDateTime_Date *self)
|
|||
|
||||
|
||||
static PyObject *
|
||||
date_ctime(PyDateTime_Date *self)
|
||||
date_ctime(PyDateTime_Date *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return format_ctime(self, 0, 0, 0);
|
||||
}
|
||||
|
@ -3055,7 +3055,7 @@ date_format(PyDateTime_Date *self, PyObject *args)
|
|||
/* ISO methods. */
|
||||
|
||||
static PyObject *
|
||||
date_isoweekday(PyDateTime_Date *self)
|
||||
date_isoweekday(PyDateTime_Date *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
int dow = weekday(GET_YEAR(self), GET_MONTH(self), GET_DAY(self));
|
||||
|
||||
|
@ -3063,7 +3063,7 @@ date_isoweekday(PyDateTime_Date *self)
|
|||
}
|
||||
|
||||
static PyObject *
|
||||
date_isocalendar(PyDateTime_Date *self)
|
||||
date_isocalendar(PyDateTime_Date *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
int year = GET_YEAR(self);
|
||||
int week1_monday = iso_week1_monday(year);
|
||||
|
@ -3100,7 +3100,7 @@ date_richcompare(PyObject *self, PyObject *other, int op)
|
|||
}
|
||||
|
||||
static PyObject *
|
||||
date_timetuple(PyDateTime_Date *self)
|
||||
date_timetuple(PyDateTime_Date *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return build_struct_time(GET_YEAR(self),
|
||||
GET_MONTH(self),
|
||||
|
@ -3149,14 +3149,14 @@ date_hash(PyDateTime_Date *self)
|
|||
}
|
||||
|
||||
static PyObject *
|
||||
date_toordinal(PyDateTime_Date *self)
|
||||
date_toordinal(PyDateTime_Date *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return PyLong_FromLong(ymd_to_ord(GET_YEAR(self), GET_MONTH(self),
|
||||
GET_DAY(self)));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
date_weekday(PyDateTime_Date *self)
|
||||
date_weekday(PyDateTime_Date *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
int dow = weekday(GET_YEAR(self), GET_MONTH(self), GET_DAY(self));
|
||||
|
||||
|
@ -3435,7 +3435,7 @@ Fail:
|
|||
*/
|
||||
|
||||
static PyObject *
|
||||
tzinfo_reduce(PyObject *self)
|
||||
tzinfo_reduce(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
PyObject *args, *state;
|
||||
PyObject *getinitargs, *getstate;
|
||||
|
@ -3502,7 +3502,7 @@ static PyMethodDef tzinfo_methods[] = {
|
|||
{"fromutc", (PyCFunction)tzinfo_fromutc, METH_O,
|
||||
PyDoc_STR("datetime in UTC -> datetime in local time.")},
|
||||
|
||||
{"__reduce__", (PyCFunction)tzinfo_reduce, METH_NOARGS,
|
||||
{"__reduce__", tzinfo_reduce, METH_NOARGS,
|
||||
PyDoc_STR("-> (cls, state)")},
|
||||
|
||||
{NULL, NULL}
|
||||
|
@ -3720,7 +3720,7 @@ timezone_fromutc(PyDateTime_TimeZone *self, PyDateTime_DateTime *dt)
|
|||
}
|
||||
|
||||
static PyObject *
|
||||
timezone_getinitargs(PyDateTime_TimeZone *self)
|
||||
timezone_getinitargs(PyDateTime_TimeZone *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
if (self->name == NULL)
|
||||
return Py_BuildValue("(O)", self->offset);
|
||||
|
@ -5173,7 +5173,7 @@ datetime_isoformat(PyDateTime_DateTime *self, PyObject *args, PyObject *kw)
|
|||
}
|
||||
|
||||
static PyObject *
|
||||
datetime_ctime(PyDateTime_DateTime *self)
|
||||
datetime_ctime(PyDateTime_DateTime *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return format_ctime((PyDateTime_Date *)self,
|
||||
DATE_GET_HOUR(self),
|
||||
|
@ -5652,7 +5652,7 @@ datetime_astimezone(PyDateTime_DateTime *self, PyObject *args, PyObject *kw)
|
|||
}
|
||||
|
||||
static PyObject *
|
||||
datetime_timetuple(PyDateTime_DateTime *self)
|
||||
datetime_timetuple(PyDateTime_DateTime *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
int dstflag = -1;
|
||||
|
||||
|
@ -5727,7 +5727,7 @@ local_to_seconds(int year, int month, int day,
|
|||
#define EPOCH_SECONDS (719163LL * 24 * 60 * 60)
|
||||
|
||||
static PyObject *
|
||||
datetime_timestamp(PyDateTime_DateTime *self)
|
||||
datetime_timestamp(PyDateTime_DateTime *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
PyObject *result;
|
||||
|
||||
|
@ -5736,7 +5736,7 @@ datetime_timestamp(PyDateTime_DateTime *self)
|
|||
delta = datetime_subtract((PyObject *)self, PyDateTime_Epoch);
|
||||
if (delta == NULL)
|
||||
return NULL;
|
||||
result = delta_total_seconds(delta);
|
||||
result = delta_total_seconds(delta, NULL);
|
||||
Py_DECREF(delta);
|
||||
}
|
||||
else {
|
||||
|
@ -5757,7 +5757,7 @@ datetime_timestamp(PyDateTime_DateTime *self)
|
|||
}
|
||||
|
||||
static PyObject *
|
||||
datetime_getdate(PyDateTime_DateTime *self)
|
||||
datetime_getdate(PyDateTime_DateTime *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return new_date(GET_YEAR(self),
|
||||
GET_MONTH(self),
|
||||
|
@ -5765,7 +5765,7 @@ datetime_getdate(PyDateTime_DateTime *self)
|
|||
}
|
||||
|
||||
static PyObject *
|
||||
datetime_gettime(PyDateTime_DateTime *self)
|
||||
datetime_gettime(PyDateTime_DateTime *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return new_time(DATE_GET_HOUR(self),
|
||||
DATE_GET_MINUTE(self),
|
||||
|
@ -5776,7 +5776,7 @@ datetime_gettime(PyDateTime_DateTime *self)
|
|||
}
|
||||
|
||||
static PyObject *
|
||||
datetime_gettimetz(PyDateTime_DateTime *self)
|
||||
datetime_gettimetz(PyDateTime_DateTime *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return new_time(DATE_GET_HOUR(self),
|
||||
DATE_GET_MINUTE(self),
|
||||
|
@ -5787,7 +5787,7 @@ datetime_gettimetz(PyDateTime_DateTime *self)
|
|||
}
|
||||
|
||||
static PyObject *
|
||||
datetime_utctimetuple(PyDateTime_DateTime *self)
|
||||
datetime_utctimetuple(PyDateTime_DateTime *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
int y, m, d, hh, mm, ss;
|
||||
PyObject *tzinfo;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue