diff options
author | Siddhesh Poyarekar <siddhesh.poyarekar@gmail.com> | 2018-04-29 18:59:33 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2018-04-29 18:59:33 (GMT) |
commit | 55edd0c185ad2d895b5d73e47d67049bc156b654 (patch) | |
tree | d609dfc924b59b89816a610ba86cd3e6c34a641c /Modules | |
parent | 9f3535c9cde8813ce631d6ebe4d790682f594828 (diff) | |
download | cpython-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')
-rw-r--r-- | Modules/_collectionsmodule.c | 26 | ||||
-rw-r--r-- | Modules/_datetimemodule.c | 42 | ||||
-rw-r--r-- | Modules/_io/bytesio.c | 2 | ||||
-rw-r--r-- | Modules/_io/fileio.c | 2 | ||||
-rw-r--r-- | Modules/_io/stringio.c | 2 | ||||
-rw-r--r-- | Modules/_io/textio.c | 4 | ||||
-rw-r--r-- | Modules/_io/winconsoleio.c | 2 | ||||
-rw-r--r-- | Modules/_localemodule.c | 9 | ||||
-rw-r--r-- | Modules/_multiprocessing/semaphore.c | 10 | ||||
-rw-r--r-- | Modules/_operator.c | 6 | ||||
-rw-r--r-- | Modules/_randommodule.c | 4 | ||||
-rw-r--r-- | Modules/_scproxy.c | 8 | ||||
-rw-r--r-- | Modules/_sqlite/row.c | 2 | ||||
-rw-r--r-- | Modules/_struct.c | 2 | ||||
-rw-r--r-- | Modules/_testbuffer.c | 4 | ||||
-rw-r--r-- | Modules/_testcapimodule.c | 147 | ||||
-rw-r--r-- | Modules/_threadmodule.c | 38 | ||||
-rw-r--r-- | Modules/_uuidmodule.c | 5 | ||||
-rw-r--r-- | Modules/_xxsubinterpretersmodule.c | 20 | ||||
-rw-r--r-- | Modules/faulthandler.c | 17 | ||||
-rw-r--r-- | Modules/itertoolsmodule.c | 46 | ||||
-rw-r--r-- | Modules/nismodule.c | 4 | ||||
-rw-r--r-- | Modules/overlapped.c | 2 | ||||
-rw-r--r-- | Modules/selectmodule.c | 12 | ||||
-rw-r--r-- | Modules/socketmodule.c | 20 |
25 files changed, 216 insertions, 220 deletions
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index 5753dd9..55132e7 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -512,7 +512,7 @@ deque_inplace_concat(dequeobject *deque, PyObject *other) } static PyObject * -deque_copy(PyObject *deque) +deque_copy(PyObject *deque, PyObject *Py_UNUSED(ignored)) { dequeobject *old_deque = (dequeobject *)deque; if (Py_TYPE(deque) == &deque_type) { @@ -563,7 +563,7 @@ deque_concat(dequeobject *deque, PyObject *other) return NULL; } - new_deque = deque_copy((PyObject *)deque); + new_deque = deque_copy((PyObject *)deque, NULL); if (new_deque == NULL) return NULL; result = deque_extend((dequeobject *)new_deque, other); @@ -659,7 +659,7 @@ deque_clear(dequeobject *deque) } static PyObject * -deque_clearmethod(dequeobject *deque) +deque_clearmethod(dequeobject *deque, PyObject *Py_UNUSED(ignored)) { deque_clear(deque); Py_RETURN_NONE; @@ -754,7 +754,7 @@ deque_repeat(dequeobject *deque, Py_ssize_t n) dequeobject *new_deque; PyObject *rv; - new_deque = (dequeobject *)deque_copy((PyObject *) deque); + new_deque = (dequeobject *)deque_copy((PyObject *) deque, NULL); if (new_deque == NULL) return NULL; rv = deque_inplace_repeat(new_deque, n); @@ -1576,7 +1576,7 @@ static PyNumberMethods deque_as_number = { }; static PyObject *deque_iter(dequeobject *deque); -static PyObject *deque_reviter(dequeobject *deque); +static PyObject *deque_reviter(dequeobject *deque, PyObject *Py_UNUSED(ignored)); PyDoc_STRVAR(reversed_doc, "D.__reversed__() -- return a reverse iterator over the deque"); @@ -1587,9 +1587,9 @@ static PyMethodDef deque_methods[] = { METH_O, appendleft_doc}, {"clear", (PyCFunction)deque_clearmethod, METH_NOARGS, clear_doc}, - {"__copy__", (PyCFunction)deque_copy, + {"__copy__", deque_copy, METH_NOARGS, copy_doc}, - {"copy", (PyCFunction)deque_copy, + {"copy", deque_copy, METH_NOARGS, copy_doc}, {"count", (PyCFunction)deque_count, METH_O, count_doc}, @@ -1774,7 +1774,7 @@ dequeiter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) } static PyObject * -dequeiter_len(dequeiterobject *it) +dequeiter_len(dequeiterobject *it, PyObject *Py_UNUSED(ignored)) { return PyLong_FromSsize_t(it->counter); } @@ -1782,7 +1782,7 @@ dequeiter_len(dequeiterobject *it) PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it))."); static PyObject * -dequeiter_reduce(dequeiterobject *it) +dequeiter_reduce(dequeiterobject *it, PyObject *Py_UNUSED(ignored)) { return Py_BuildValue("O(On)", Py_TYPE(it), it->deque, Py_SIZE(it->deque) - it->counter); } @@ -1841,7 +1841,7 @@ static PyTypeObject dequeiter_type = { static PyTypeObject dequereviter_type; static PyObject * -deque_reviter(dequeobject *deque) +deque_reviter(dequeobject *deque, PyObject *Py_UNUSED(ignored)) { dequeiterobject *it; @@ -1896,7 +1896,7 @@ dequereviter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return NULL; assert(type == &dequereviter_type); - it = (dequeiterobject*)deque_reviter((dequeobject *)deque); + it = (dequeiterobject*)deque_reviter((dequeobject *)deque, NULL); if (!it) return NULL; /* consume items from the queue */ @@ -2001,7 +2001,7 @@ defdict_missing(defdictobject *dd, PyObject *key) PyDoc_STRVAR(defdict_copy_doc, "D.copy() -> a shallow copy of D."); static PyObject * -defdict_copy(defdictobject *dd) +defdict_copy(defdictobject *dd, PyObject *Py_UNUSED(ignored)) { /* This calls the object's class. That only works for subclasses whose class constructor has the same signature. Subclasses that @@ -2015,7 +2015,7 @@ defdict_copy(defdictobject *dd) } static PyObject * -defdict_reduce(defdictobject *dd) +defdict_reduce(defdictobject *dd, PyObject *Py_UNUSED(ignored)) { /* __reduce__ must return a 5-tuple as follows: diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c index 6855903..cc7eee6 100644 --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -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; diff --git a/Modules/_io/bytesio.c b/Modules/_io/bytesio.c index ba33f8c..a50add2 100644 --- a/Modules/_io/bytesio.c +++ b/Modules/_io/bytesio.c @@ -758,7 +758,7 @@ _io_BytesIO_close_impl(bytesio *self) */ static PyObject * -bytesio_getstate(bytesio *self) +bytesio_getstate(bytesio *self, PyObject *Py_UNUSED(ignored)) { PyObject *initvalue = _io_BytesIO_getvalue_impl(self); PyObject *dict; diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c index 0d5bf3b..c0e43e0 100644 --- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c @@ -1123,7 +1123,7 @@ _io_FileIO_isatty_impl(fileio *self) } static PyObject * -fileio_getstate(fileio *self) +fileio_getstate(fileio *self, PyObject *Py_UNUSED(ignored)) { PyErr_Format(PyExc_TypeError, "cannot serialize '%s' object", Py_TYPE(self)->tp_name); diff --git a/Modules/_io/stringio.c b/Modules/_io/stringio.c index 718b1ac..f280b30 100644 --- a/Modules/_io/stringio.c +++ b/Modules/_io/stringio.c @@ -812,7 +812,7 @@ _io_StringIO_seekable_impl(stringio *self) */ static PyObject * -stringio_getstate(stringio *self) +stringio_getstate(stringio *self, PyObject *Py_UNUSED(ignored)) { PyObject *initvalue = _io_StringIO_getvalue_impl(self); PyObject *dict; diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c index 717b56a..209aa13 100644 --- a/Modules/_io/textio.c +++ b/Modules/_io/textio.c @@ -66,7 +66,7 @@ PyDoc_STRVAR(textiobase_detach_doc, ); static PyObject * -textiobase_detach(PyObject *self) +textiobase_detach(PyObject *self, PyObject *Py_UNUSED(ignored)) { return _unsupported("detach"); } @@ -148,7 +148,7 @@ textiobase_errors_get(PyObject *self, void *context) static PyMethodDef textiobase_methods[] = { - {"detach", (PyCFunction)textiobase_detach, METH_NOARGS, textiobase_detach_doc}, + {"detach", textiobase_detach, METH_NOARGS, textiobase_detach_doc}, {"read", textiobase_read, METH_VARARGS, textiobase_read_doc}, {"readline", textiobase_readline, METH_VARARGS, textiobase_readline_doc}, {"write", textiobase_write, METH_VARARGS, textiobase_write_doc}, diff --git a/Modules/_io/winconsoleio.c b/Modules/_io/winconsoleio.c index b85c11b..2bf48eb 100644 --- a/Modules/_io/winconsoleio.c +++ b/Modules/_io/winconsoleio.c @@ -1057,7 +1057,7 @@ _io__WindowsConsoleIO_isatty_impl(winconsoleio *self) } static PyObject * -winconsoleio_getstate(winconsoleio *self) +winconsoleio_getstate(winconsoleio *self, PyObject *Py_UNUSED(ignored)) { PyErr_Format(PyExc_TypeError, "cannot serialize '%s' object", Py_TYPE(self)->tp_name); diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c index f9eeeb7..524886d 100644 --- a/Modules/_localemodule.c +++ b/Modules/_localemodule.c @@ -132,7 +132,7 @@ PyDoc_STRVAR(localeconv__doc__, "() -> dict. Returns numeric and monetary locale-specific parameters."); static PyObject* -PyLocale_localeconv(PyObject* self) +PyLocale_localeconv(PyObject* self, PyObject *Py_UNUSED(ignored)) { PyObject* result; struct lconv *l; @@ -317,7 +317,7 @@ exit: #if defined(MS_WINDOWS) static PyObject* -PyLocale_getdefaultlocale(PyObject* self) +PyLocale_getdefaultlocale(PyObject* self, PyObject *Py_UNUSED(ignored)) { char encoding[100]; char locale[100]; @@ -605,8 +605,7 @@ PyIntl_bind_textdomain_codeset(PyObject* self,PyObject*args) static struct PyMethodDef PyLocale_Methods[] = { {"setlocale", (PyCFunction) PyLocale_setlocale, METH_VARARGS, setlocale__doc__}, - {"localeconv", (PyCFunction) PyLocale_localeconv, - METH_NOARGS, localeconv__doc__}, + {"localeconv", PyLocale_localeconv, METH_NOARGS, localeconv__doc__}, #ifdef HAVE_WCSCOLL {"strcoll", (PyCFunction) PyLocale_strcoll, METH_VARARGS, strcoll__doc__}, @@ -616,7 +615,7 @@ static struct PyMethodDef PyLocale_Methods[] = { METH_VARARGS, strxfrm__doc__}, #endif #if defined(MS_WINDOWS) - {"_getdefaultlocale", (PyCFunction) PyLocale_getdefaultlocale, METH_NOARGS}, + {"_getdefaultlocale", PyLocale_getdefaultlocale, METH_NOARGS}, #endif #ifdef HAVE_LANGINFO_H {"nl_langinfo", (PyCFunction) PyLocale_nl_langinfo, diff --git a/Modules/_multiprocessing/semaphore.c b/Modules/_multiprocessing/semaphore.c index 0092b13..b1d3a21 100644 --- a/Modules/_multiprocessing/semaphore.c +++ b/Modules/_multiprocessing/semaphore.c @@ -518,20 +518,20 @@ semlock_dealloc(SemLockObject* self) } static PyObject * -semlock_count(SemLockObject *self) +semlock_count(SemLockObject *self, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong((long)self->count); } static PyObject * -semlock_ismine(SemLockObject *self) +semlock_ismine(SemLockObject *self, PyObject *Py_UNUSED(ignored)) { /* only makes sense for a lock */ return PyBool_FromLong(ISMINE(self)); } static PyObject * -semlock_getvalue(SemLockObject *self) +semlock_getvalue(SemLockObject *self, PyObject *Py_UNUSED(ignored)) { #ifdef HAVE_BROKEN_SEM_GETVALUE PyErr_SetNone(PyExc_NotImplementedError); @@ -549,7 +549,7 @@ semlock_getvalue(SemLockObject *self) } static PyObject * -semlock_iszero(SemLockObject *self) +semlock_iszero(SemLockObject *self, PyObject *Py_UNUSED(ignored)) { #ifdef HAVE_BROKEN_SEM_GETVALUE if (sem_trywait(self->handle) < 0) { @@ -570,7 +570,7 @@ semlock_iszero(SemLockObject *self) } static PyObject * -semlock_afterfork(SemLockObject *self) +semlock_afterfork(SemLockObject *self, PyObject *Py_UNUSED(ignored)) { self->count = 0; Py_RETURN_NONE; diff --git a/Modules/_operator.c b/Modules/_operator.c index f2fd656..dc67820 100644 --- a/Modules/_operator.c +++ b/Modules/_operator.c @@ -1040,7 +1040,7 @@ itemgetter_repr(itemgetterobject *ig) } static PyObject * -itemgetter_reduce(itemgetterobject *ig) +itemgetter_reduce(itemgetterobject *ig, PyObject *Py_UNUSED(ignored)) { if (ig->nitems == 1) return Py_BuildValue("O(O)", Py_TYPE(ig), ig->item); @@ -1382,7 +1382,7 @@ attrgetter_repr(attrgetterobject *ag) } static PyObject * -attrgetter_reduce(attrgetterobject *ag) +attrgetter_reduce(attrgetterobject *ag, PyObject *Py_UNUSED(ignored)) { PyObject *attrstrings = attrgetter_args(ag); if (attrstrings == NULL) @@ -1615,7 +1615,7 @@ done: } static PyObject * -methodcaller_reduce(methodcallerobject *mc) +methodcaller_reduce(methodcallerobject *mc, PyObject *Py_UNUSED(ignored)) { PyObject *newargs; if (!mc->kwds || PyDict_GET_SIZE(mc->kwds) == 0) { diff --git a/Modules/_randommodule.c b/Modules/_randommodule.c index 51677f8..dae9d42 100644 --- a/Modules/_randommodule.c +++ b/Modules/_randommodule.c @@ -138,7 +138,7 @@ genrand_int32(RandomObject *self) * The original code credited Isaku Wada for this algorithm, 2002/01/09. */ static PyObject * -random_random(RandomObject *self) +random_random(RandomObject *self, PyObject *Py_UNUSED(ignored)) { uint32_t a=genrand_int32(self)>>5, b=genrand_int32(self)>>6; return PyFloat_FromDouble((a*67108864.0+b)*(1.0/9007199254740992.0)); @@ -319,7 +319,7 @@ Done: } static PyObject * -random_getstate(RandomObject *self) +random_getstate(RandomObject *self, PyObject *Py_UNUSED(ignored)) { PyObject *state; PyObject *element; diff --git a/Modules/_scproxy.c b/Modules/_scproxy.c index 0e3b028..8861dc4 100644 --- a/Modules/_scproxy.c +++ b/Modules/_scproxy.c @@ -53,7 +53,7 @@ cfstring_to_pystring(CFStringRef ref) static PyObject* -get_proxy_settings(PyObject* mod __attribute__((__unused__))) +get_proxy_settings(PyObject* Py_UNUSED(mod), PyObject *Py_UNUSED(ignored)) { CFDictionaryRef proxyDict = NULL; CFNumberRef aNum = NULL; @@ -166,7 +166,7 @@ set_proxy(PyObject* proxies, const char* proto, CFDictionaryRef proxyDict, static PyObject* -get_proxies(PyObject* mod __attribute__((__unused__))) +get_proxies(PyObject* Py_UNUSED(mod), PyObject *Py_UNUSED(ignored)) { PyObject* result = NULL; int r; @@ -212,13 +212,13 @@ error: static PyMethodDef mod_methods[] = { { "_get_proxy_settings", - (PyCFunction)get_proxy_settings, + get_proxy_settings, METH_NOARGS, NULL, }, { "_get_proxies", - (PyCFunction)get_proxies, + get_proxies, METH_NOARGS, NULL, }, diff --git a/Modules/_sqlite/row.c b/Modules/_sqlite/row.c index ec2c788..64872e8 100644 --- a/Modules/_sqlite/row.c +++ b/Modules/_sqlite/row.c @@ -155,7 +155,7 @@ Py_ssize_t pysqlite_row_length(pysqlite_Row* self, PyObject* args, PyObject* kwa return PyTuple_GET_SIZE(self->data); } -PyObject* pysqlite_row_keys(pysqlite_Row* self, PyObject* args, PyObject* kwargs) +PyObject* pysqlite_row_keys(pysqlite_Row* self, PyObject *Py_UNUSED(ignored)) { PyObject* list; Py_ssize_t nitems, i; diff --git a/Modules/_struct.c b/Modules/_struct.c index 0539706..0be52d9 100644 --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -1629,7 +1629,7 @@ unpackiter_traverse(unpackiterobject *self, visitproc visit, void *arg) } static PyObject * -unpackiter_len(unpackiterobject *self) +unpackiter_len(unpackiterobject *self, PyObject *Py_UNUSED(ignored)) { Py_ssize_t len; if (self->so == NULL) diff --git a/Modules/_testbuffer.c b/Modules/_testbuffer.c index 6b8ab34..221543d 100644 --- a/Modules/_testbuffer.c +++ b/Modules/_testbuffer.c @@ -2354,7 +2354,7 @@ out: } static PyObject * -get_sizeof_void_p(PyObject *self) +get_sizeof_void_p(PyObject *self, PyObject *Py_UNUSED(ignored)) { return PyLong_FromSize_t(sizeof(void *)); } @@ -2807,7 +2807,7 @@ static PyTypeObject StaticArray_Type = { static struct PyMethodDef _testbuffer_functions[] = { {"slice_indices", slice_indices, METH_VARARGS, NULL}, {"get_pointer", get_pointer, METH_VARARGS, NULL}, - {"get_sizeof_void_p", (PyCFunction)get_sizeof_void_p, METH_NOARGS, NULL}, + {"get_sizeof_void_p", get_sizeof_void_p, METH_NOARGS, NULL}, {"get_contiguous", get_contiguous, METH_VARARGS, NULL}, {"py_buffer_to_contiguous", py_buffer_to_contiguous, METH_VARARGS, NULL}, {"is_contiguous", is_contiguous, METH_VARARGS, NULL}, diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index afce6c9..0e48463 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -51,7 +51,7 @@ sizeof_error(const char* fatname, const char* typname, } static PyObject* -test_config(PyObject *self) +test_config(PyObject *self, PyObject *Py_UNUSED(ignored)) { #define CHECK_SIZEOF(FATNAME, TYPE) \ if (FATNAME != sizeof(TYPE)) \ @@ -70,7 +70,7 @@ test_config(PyObject *self) } static PyObject* -test_sizeof_c_types(PyObject *self) +test_sizeof_c_types(PyObject *self, PyObject *Py_UNUSED(ignored)) { #if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5))) #pragma GCC diagnostic push @@ -131,7 +131,7 @@ test_sizeof_c_types(PyObject *self) static PyObject* -test_list_api(PyObject *self) +test_list_api(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject* list; int i; @@ -223,7 +223,7 @@ test_dict_inner(int count) } static PyObject* -test_dict_iteration(PyObject* self) +test_dict_iteration(PyObject* self, PyObject *Py_UNUSED(ignored)) { int i; @@ -315,7 +315,7 @@ static PyTypeObject _HashInheritanceTester_Type = { }; static PyObject* -test_lazy_hash_inheritance(PyObject* self) +test_lazy_hash_inheritance(PyObject* self, PyObject *Py_UNUSED(ignored)) { PyTypeObject *type; PyObject *obj; @@ -411,7 +411,7 @@ raise_test_long_error(const char* msg) #include "testcapi_long.h" static PyObject * -test_long_api(PyObject* self) +test_long_api(PyObject* self, PyObject *Py_UNUSED(ignored)) { return TESTNAME(raise_test_long_error); } @@ -457,7 +457,7 @@ test_longlong_api(PyObject* self, PyObject *args) */ static PyObject * -test_long_and_overflow(PyObject *self) +test_long_and_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject *num, *one, *temp; long value; @@ -621,7 +621,7 @@ test_long_and_overflow(PyObject *self) */ static PyObject * -test_long_long_and_overflow(PyObject *self) +test_long_long_and_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject *num, *one, *temp; long long value; @@ -785,7 +785,7 @@ test_long_long_and_overflow(PyObject *self) */ static PyObject * -test_long_as_size_t(PyObject *self) +test_long_as_size_t(PyObject *self, PyObject *Py_UNUSED(ignored)) { size_t out_u; Py_ssize_t out_s; @@ -821,7 +821,7 @@ test_long_as_size_t(PyObject *self) */ static PyObject * -test_long_as_double(PyObject *self) +test_long_as_double(PyObject *self, PyObject *Py_UNUSED(ignored)) { double out; @@ -846,7 +846,7 @@ test_long_as_double(PyObject *self) it fails. */ static PyObject * -test_L_code(PyObject *self) +test_L_code(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject *tuple, *num; long long value; @@ -1173,7 +1173,7 @@ getargs_K(PyObject *self, PyObject *args) /* This function not only tests the 'k' getargs code, but also the PyLong_AsUnsignedLongMask() function. */ static PyObject * -test_k_code(PyObject *self) +test_k_code(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject *tuple, *num; unsigned long value; @@ -1531,7 +1531,7 @@ getargs_et_hash(PyObject *self, PyObject *args) /* Test the s and z codes for PyArg_ParseTuple. */ static PyObject * -test_s_code(PyObject *self) +test_s_code(PyObject *self, PyObject *Py_UNUSED(ignored)) { /* Unicode strings should be accepted */ PyObject *tuple, *obj; @@ -1637,7 +1637,7 @@ static volatile int x; of an error. */ static PyObject * -test_u_code(PyObject *self) +test_u_code(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject *tuple, *obj; Py_UNICODE *value; @@ -1680,7 +1680,7 @@ test_u_code(PyObject *self) /* Test Z and Z# codes for PyArg_ParseTuple */ static PyObject * -test_Z_code(PyObject *self) +test_Z_code(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject *tuple, *obj; const Py_UNICODE *value1, *value2; @@ -1735,7 +1735,7 @@ test_Z_code(PyObject *self) } static PyObject * -test_widechar(PyObject *self) +test_widechar(PyObject *self, PyObject *Py_UNUSED(ignored)) { #if defined(SIZEOF_WCHAR_T) && (SIZEOF_WCHAR_T == 4) const wchar_t wtext[2] = {(wchar_t)0x10ABCDu}; @@ -2033,7 +2033,7 @@ getargs_w_star(PyObject *self, PyObject *args) static PyObject * -test_empty_argparse(PyObject *self) +test_empty_argparse(PyObject *self, PyObject *Py_UNUSED(ignored)) { /* Test that formats can begin with '|'. See issue #4720. */ PyObject *tuple, *dict = NULL; @@ -2083,7 +2083,7 @@ codec_incrementaldecoder(PyObject *self, PyObject *args) /* Simple test of _PyLong_NumBits and _PyLong_Sign. */ static PyObject * -test_long_numbits(PyObject *self) +test_long_numbits(PyObject *self, PyObject *Py_UNUSED(ignored)) { struct triple { long input; @@ -2131,7 +2131,7 @@ test_long_numbits(PyObject *self) /* Example passing NULLs to PyObject_Str(NULL). */ static PyObject * -test_null_strings(PyObject *self) +test_null_strings(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject *o1 = PyObject_Str(NULL), *o2 = PyObject_Str(NULL); PyObject *tuple = PyTuple_Pack(2, o1, o2); @@ -2492,7 +2492,7 @@ test_string_from_format(PyObject *self, PyObject *args) static PyObject * -test_unicode_compare_with_ascii(PyObject *self) { +test_unicode_compare_with_ascii(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject *py_s = PyUnicode_FromStringAndSize("str\0", 4); int result; if (py_s == NULL) @@ -2509,14 +2509,14 @@ test_unicode_compare_with_ascii(PyObject *self) { /* This is here to provide a docstring for test_descr. */ static PyObject * -test_with_docstring(PyObject *self) +test_with_docstring(PyObject *self, PyObject *Py_UNUSED(ignored)) { Py_RETURN_NONE; } /* Test PyOS_string_to_double. */ static PyObject * -test_string_to_double(PyObject *self) { +test_string_to_double(PyObject *self, PyObject *Py_UNUSED(ignored)) { double result; const char *msg; @@ -2881,7 +2881,7 @@ exception_print(PyObject *self, PyObject *args) /* reliably raise a MemoryError */ static PyObject * -raise_memoryerror(PyObject *self) +raise_memoryerror(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyErr_NoMemory(); return NULL; @@ -2954,7 +2954,7 @@ make_exception_with_doc(PyObject *self, PyObject *args, PyObject *kwargs) } static PyObject * -make_memoryview_from_NULL_pointer(PyObject *self) +make_memoryview_from_NULL_pointer(PyObject *self, PyObject *Py_UNUSED(ignored)) { Py_buffer info; if (PyBuffer_FillInfo(&info, NULL, NULL, 1, 1, PyBUF_FULL_RO) < 0) @@ -3067,7 +3067,7 @@ getbuffer_with_null_view(PyObject* self, PyObject *obj) /* Test that the fatal error from not having a current thread doesn't cause an infinite loop. Run via Lib/test/test_capi.py */ static PyObject * -crash_no_current_thread(PyObject *self) +crash_no_current_thread(PyObject *self, PyObject *Py_UNUSED(ignored)) { Py_BEGIN_ALLOW_THREADS /* Using PyThreadState_Get() directly allows the test to pass in @@ -3274,7 +3274,7 @@ _test_incref(PyObject *ob) } static PyObject * -test_xincref_doesnt_leak(PyObject *ob) +test_xincref_doesnt_leak(PyObject *ob, PyObject *Py_UNUSED(ignored)) { PyObject *obj = PyLong_FromLong(0); Py_XINCREF(_test_incref(obj)); @@ -3285,7 +3285,7 @@ test_xincref_doesnt_leak(PyObject *ob) } static PyObject * -test_incref_doesnt_leak(PyObject *ob) +test_incref_doesnt_leak(PyObject *ob, PyObject *Py_UNUSED(ignored)) { PyObject *obj = PyLong_FromLong(0); Py_INCREF(_test_incref(obj)); @@ -3296,21 +3296,21 @@ test_incref_doesnt_leak(PyObject *ob) } static PyObject * -test_xdecref_doesnt_leak(PyObject *ob) +test_xdecref_doesnt_leak(PyObject *ob, PyObject *Py_UNUSED(ignored)) { Py_XDECREF(PyLong_FromLong(0)); Py_RETURN_NONE; } static PyObject * -test_decref_doesnt_leak(PyObject *ob) +test_decref_doesnt_leak(PyObject *ob, PyObject *Py_UNUSED(ignored)) { Py_DECREF(PyLong_FromLong(0)); Py_RETURN_NONE; } static PyObject * -test_incref_decref_API(PyObject *ob) +test_incref_decref_API(PyObject *ob, PyObject *Py_UNUSED(ignored)) { PyObject *obj = PyLong_FromLong(0); Py_IncRef(obj); @@ -3320,7 +3320,7 @@ test_incref_decref_API(PyObject *ob) } static PyObject * -test_pymem_alloc0(PyObject *self) +test_pymem_alloc0(PyObject *self, PyObject *Py_UNUSED(ignored)) { void *ptr; @@ -3546,19 +3546,19 @@ finally: } static PyObject * -test_pymem_setrawallocators(PyObject *self) +test_pymem_setrawallocators(PyObject *self, PyObject *Py_UNUSED(ignored)) { return test_setallocators(PYMEM_DOMAIN_RAW); } static PyObject * -test_pymem_setallocators(PyObject *self) +test_pymem_setallocators(PyObject *self, PyObject *Py_UNUSED(ignored)) { return test_setallocators(PYMEM_DOMAIN_MEM); } static PyObject * -test_pyobject_setallocators(PyObject *self) +test_pyobject_setallocators(PyObject *self, PyObject *Py_UNUSED(ignored)) { return test_setallocators(PYMEM_DOMAIN_OBJ); } @@ -3681,7 +3681,7 @@ set_nomemory(PyObject *self, PyObject *args) } static PyObject* -remove_mem_hooks(PyObject *self) +remove_mem_hooks(PyObject *self, PyObject *Py_UNUSED(ignored)) { fm_remove_hooks(); Py_RETURN_NONE; @@ -4552,10 +4552,10 @@ new_hamt(PyObject *self, PyObject *args) static PyMethodDef TestMethods[] = { {"raise_exception", raise_exception, METH_VARARGS}, - {"raise_memoryerror", (PyCFunction)raise_memoryerror, METH_NOARGS}, + {"raise_memoryerror", raise_memoryerror, METH_NOARGS}, {"set_errno", set_errno, METH_VARARGS}, - {"test_config", (PyCFunction)test_config, METH_NOARGS}, - {"test_sizeof_c_types", (PyCFunction)test_sizeof_c_types, METH_NOARGS}, + {"test_config", test_config, METH_NOARGS}, + {"test_sizeof_c_types", test_sizeof_c_types, METH_NOARGS}, {"test_datetime_capi", test_datetime_capi, METH_NOARGS}, {"datetime_check_date", datetime_check_date, METH_VARARGS}, {"datetime_check_time", datetime_check_time, METH_VARARGS}, @@ -4565,31 +4565,31 @@ static PyMethodDef TestMethods[] = { {"make_timezones_capi", make_timezones_capi, METH_NOARGS}, {"get_timezones_offset_zero", get_timezones_offset_zero, METH_NOARGS}, {"get_timezone_utc_capi", get_timezone_utc_capi, METH_VARARGS}, - {"test_list_api", (PyCFunction)test_list_api, METH_NOARGS}, - {"test_dict_iteration", (PyCFunction)test_dict_iteration,METH_NOARGS}, + {"test_list_api", test_list_api, METH_NOARGS}, + {"test_dict_iteration", test_dict_iteration, METH_NOARGS}, {"dict_getitem_knownhash", dict_getitem_knownhash, METH_VARARGS}, {"dict_hassplittable", dict_hassplittable, METH_O}, - {"test_lazy_hash_inheritance", (PyCFunction)test_lazy_hash_inheritance,METH_NOARGS}, - {"test_long_api", (PyCFunction)test_long_api, METH_NOARGS}, - {"test_xincref_doesnt_leak",(PyCFunction)test_xincref_doesnt_leak, METH_NOARGS}, - {"test_incref_doesnt_leak", (PyCFunction)test_incref_doesnt_leak, METH_NOARGS}, - {"test_xdecref_doesnt_leak",(PyCFunction)test_xdecref_doesnt_leak, METH_NOARGS}, - {"test_decref_doesnt_leak", (PyCFunction)test_decref_doesnt_leak, METH_NOARGS}, - {"test_incref_decref_API", (PyCFunction)test_incref_decref_API, METH_NOARGS}, - {"test_long_and_overflow", (PyCFunction)test_long_and_overflow, - METH_NOARGS}, - {"test_long_as_double", (PyCFunction)test_long_as_double,METH_NOARGS}, - {"test_long_as_size_t", (PyCFunction)test_long_as_size_t,METH_NOARGS}, - {"test_long_numbits", (PyCFunction)test_long_numbits, METH_NOARGS}, - {"test_k_code", (PyCFunction)test_k_code, METH_NOARGS}, - {"test_empty_argparse", (PyCFunction)test_empty_argparse,METH_NOARGS}, + {"test_lazy_hash_inheritance", test_lazy_hash_inheritance,METH_NOARGS}, + {"test_long_api", test_long_api, METH_NOARGS}, + {"test_xincref_doesnt_leak",test_xincref_doesnt_leak, METH_NOARGS}, + {"test_incref_doesnt_leak", test_incref_doesnt_leak, METH_NOARGS}, + {"test_xdecref_doesnt_leak",test_xdecref_doesnt_leak, METH_NOARGS}, + {"test_decref_doesnt_leak", test_decref_doesnt_leak, METH_NOARGS}, + {"test_incref_decref_API", test_incref_decref_API, METH_NOARGS}, + {"test_long_and_overflow", test_long_and_overflow, METH_NOARGS}, + {"test_long_as_double", test_long_as_double, METH_NOARGS}, + {"test_long_as_size_t", test_long_as_size_t, METH_NOARGS}, + {"test_long_numbits", test_long_numbits, METH_NOARGS}, + {"test_k_code", test_k_code, METH_NOARGS}, + {"test_empty_argparse", test_empty_argparse, METH_NOARGS}, {"parse_tuple_and_keywords", parse_tuple_and_keywords, METH_VARARGS}, - {"test_null_strings", (PyCFunction)test_null_strings, METH_NOARGS}, + {"test_null_strings", test_null_strings, METH_NOARGS}, {"test_string_from_format", (PyCFunction)test_string_from_format, METH_NOARGS}, - {"test_with_docstring", (PyCFunction)test_with_docstring, METH_NOARGS, + {"test_with_docstring", test_with_docstring, METH_NOARGS, PyDoc_STR("This is a pretty normal docstring.")}, - {"test_string_to_double", (PyCFunction)test_string_to_double, METH_NOARGS}, - {"test_unicode_compare_with_ascii", (PyCFunction)test_unicode_compare_with_ascii, METH_NOARGS}, + {"test_string_to_double", test_string_to_double, METH_NOARGS}, + {"test_unicode_compare_with_ascii", test_unicode_compare_with_ascii, + METH_NOARGS}, {"test_capsule", (PyCFunction)test_capsule, METH_NOARGS}, {"test_from_contiguous", (PyCFunction)test_from_contiguous, METH_NOARGS}, #if (defined(__linux__) || defined(__FreeBSD__)) && defined(__GNUC__) @@ -4620,9 +4620,8 @@ static PyMethodDef TestMethods[] = { {"getargs_L", getargs_L, METH_VARARGS}, {"getargs_K", getargs_K, METH_VARARGS}, {"test_longlong_api", test_longlong_api, METH_NOARGS}, - {"test_long_long_and_overflow", - (PyCFunction)test_long_long_and_overflow, METH_NOARGS}, - {"test_L_code", (PyCFunction)test_L_code, METH_NOARGS}, + {"test_long_long_and_overflow",test_long_long_and_overflow, METH_NOARGS}, + {"test_L_code", test_L_code, METH_NOARGS}, {"getargs_f", getargs_f, METH_VARARGS}, {"getargs_d", getargs_d, METH_VARARGS}, {"getargs_D", getargs_D, METH_VARARGS}, @@ -4653,10 +4652,10 @@ static PyMethodDef TestMethods[] = { (PyCFunction)codec_incrementalencoder, METH_VARARGS}, {"codec_incrementaldecoder", (PyCFunction)codec_incrementaldecoder, METH_VARARGS}, - {"test_s_code", (PyCFunction)test_s_code, METH_NOARGS}, - {"test_u_code", (PyCFunction)test_u_code, METH_NOARGS}, - {"test_Z_code", (PyCFunction)test_Z_code, METH_NOARGS}, - {"test_widechar", (PyCFunction)test_widechar, METH_NOARGS}, + {"test_s_code", test_s_code, METH_NOARGS}, + {"test_u_code", test_u_code, METH_NOARGS}, + {"test_Z_code", test_Z_code, METH_NOARGS}, + {"test_widechar", test_widechar, METH_NOARGS}, {"unicode_aswidechar", unicode_aswidechar, METH_VARARGS}, {"unicode_aswidecharstring",unicode_aswidecharstring, METH_VARARGS}, {"unicode_asucs4", unicode_asucs4, METH_VARARGS}, @@ -4677,26 +4676,22 @@ static PyMethodDef TestMethods[] = { {"code_newempty", code_newempty, METH_VARARGS}, {"make_exception_with_doc", (PyCFunction)make_exception_with_doc, METH_VARARGS | METH_KEYWORDS}, - {"make_memoryview_from_NULL_pointer", (PyCFunction)make_memoryview_from_NULL_pointer, + {"make_memoryview_from_NULL_pointer", make_memoryview_from_NULL_pointer, METH_NOARGS}, - {"crash_no_current_thread", (PyCFunction)crash_no_current_thread, METH_NOARGS}, + {"crash_no_current_thread", crash_no_current_thread, METH_NOARGS}, {"run_in_subinterp", run_in_subinterp, METH_VARARGS}, {"pytime_object_to_time_t", test_pytime_object_to_time_t, METH_VARARGS}, {"pytime_object_to_timeval", test_pytime_object_to_timeval, METH_VARARGS}, {"pytime_object_to_timespec", test_pytime_object_to_timespec, METH_VARARGS}, {"with_tp_del", with_tp_del, METH_VARARGS}, {"create_cfunction", create_cfunction, METH_NOARGS}, - {"test_pymem_alloc0", - (PyCFunction)test_pymem_alloc0, METH_NOARGS}, - {"test_pymem_setrawallocators", - (PyCFunction)test_pymem_setrawallocators, METH_NOARGS}, - {"test_pymem_setallocators", - (PyCFunction)test_pymem_setallocators, METH_NOARGS}, - {"test_pyobject_setallocators", - (PyCFunction)test_pyobject_setallocators, METH_NOARGS}, + {"test_pymem_alloc0", test_pymem_alloc0, METH_NOARGS}, + {"test_pymem_setrawallocators",test_pymem_setrawallocators, METH_NOARGS}, + {"test_pymem_setallocators",test_pymem_setallocators, METH_NOARGS}, + {"test_pyobject_setallocators",test_pyobject_setallocators, METH_NOARGS}, {"set_nomemory", (PyCFunction)set_nomemory, METH_VARARGS, PyDoc_STR("set_nomemory(start:int, stop:int = 0)")}, - {"remove_mem_hooks", (PyCFunction)remove_mem_hooks, METH_NOARGS, + {"remove_mem_hooks", remove_mem_hooks, METH_NOARGS, PyDoc_STR("Remove memory hooks.")}, {"no_docstring", (PyCFunction)test_with_docstring, METH_NOARGS}, diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c index 43898d8..69e27be 100644 --- a/Modules/_threadmodule.c +++ b/Modules/_threadmodule.c @@ -163,7 +163,7 @@ and the return value reflects whether the lock is acquired.\n\ The blocking operation is interruptible."); static PyObject * -lock_PyThread_release_lock(lockobject *self) +lock_PyThread_release_lock(lockobject *self, PyObject *Py_UNUSED(ignored)) { /* Sanity check: the lock must be locked */ if (!self->locked) { @@ -185,7 +185,7 @@ the lock to acquire the lock. The lock must be in the locked state,\n\ but it needn't be locked by the same thread that unlocks it."); static PyObject * -lock_locked_lock(lockobject *self) +lock_locked_lock(lockobject *self, PyObject *Py_UNUSED(ignored)) { return PyBool_FromLong((long)self->locked); } @@ -333,7 +333,7 @@ internal counter is simply incremented. If nobody holds the lock,\n\ the lock is taken and its internal counter initialized to 1."); static PyObject * -rlock_release(rlockobject *self) +rlock_release(rlockobject *self, PyObject *Py_UNUSED(ignored)) { unsigned long tid = PyThread_get_thread_ident(); @@ -392,7 +392,7 @@ PyDoc_STRVAR(rlock_acquire_restore_doc, For internal use by `threading.Condition`."); static PyObject * -rlock_release_save(rlockobject *self) +rlock_release_save(rlockobject *self, PyObject *Py_UNUSED(ignored)) { unsigned long owner; unsigned long count; @@ -418,7 +418,7 @@ For internal use by `threading.Condition`."); static PyObject * -rlock_is_owned(rlockobject *self) +rlock_is_owned(rlockobject *self, PyObject *Py_UNUSED(ignored)) { unsigned long tid = PyThread_get_thread_ident(); @@ -1087,7 +1087,7 @@ when the function raises an unhandled exception; a stack trace will be\n\ printed unless the exception is SystemExit.\n"); static PyObject * -thread_PyThread_exit_thread(PyObject *self) +thread_PyThread_exit_thread(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyErr_SetNone(PyExc_SystemExit); return NULL; @@ -1101,7 +1101,7 @@ This is synonymous to ``raise SystemExit''. It will cause the current\n\ thread to exit silently unless the exception is caught."); static PyObject * -thread_PyThread_interrupt_main(PyObject * self) +thread_PyThread_interrupt_main(PyObject * self, PyObject *Py_UNUSED(ignored)) { PyErr_SetInterrupt(); Py_RETURN_NONE; @@ -1117,7 +1117,7 @@ A subthread can use this function to interrupt the main thread." static lockobject *newlockobject(void); static PyObject * -thread_PyThread_allocate_lock(PyObject *self) +thread_PyThread_allocate_lock(PyObject *self, PyObject *Py_UNUSED(ignored)) { return (PyObject *) newlockobject(); } @@ -1130,7 +1130,7 @@ Create a new lock object. See help(type(threading.Lock())) for\n\ information about locks."); static PyObject * -thread_get_ident(PyObject *self) +thread_get_ident(PyObject *self, PyObject *Py_UNUSED(ignored)) { unsigned long ident = PyThread_get_thread_ident(); if (ident == PYTHREAD_INVALID_THREAD_ID) { @@ -1152,7 +1152,7 @@ be relied upon, and the number should be seen purely as a magic cookie.\n\ A thread's identity may be reused for another thread after it exits."); static PyObject * -thread__count(PyObject *self) +thread__count(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyThreadState *tstate = PyThreadState_Get(); return PyLong_FromLong(tstate->interp->num_threads); @@ -1192,7 +1192,7 @@ release_sentinel(void *wr) } static PyObject * -thread__set_sentinel(PyObject *self) +thread__set_sentinel(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject *wr; PyThreadState *tstate = PyThreadState_Get(); @@ -1289,23 +1289,23 @@ static PyMethodDef thread_methods[] = { METH_VARARGS, start_new_doc}, {"start_new", (PyCFunction)thread_PyThread_start_new_thread, METH_VARARGS, start_new_doc}, - {"allocate_lock", (PyCFunction)thread_PyThread_allocate_lock, + {"allocate_lock", thread_PyThread_allocate_lock, METH_NOARGS, allocate_doc}, - {"allocate", (PyCFunction)thread_PyThread_allocate_lock, + {"allocate", thread_PyThread_allocate_lock, METH_NOARGS, allocate_doc}, - {"exit_thread", (PyCFunction)thread_PyThread_exit_thread, + {"exit_thread", thread_PyThread_exit_thread, METH_NOARGS, exit_doc}, - {"exit", (PyCFunction)thread_PyThread_exit_thread, + {"exit", thread_PyThread_exit_thread, METH_NOARGS, exit_doc}, - {"interrupt_main", (PyCFunction)thread_PyThread_interrupt_main, + {"interrupt_main", thread_PyThread_interrupt_main, METH_NOARGS, interrupt_doc}, - {"get_ident", (PyCFunction)thread_get_ident, + {"get_ident", thread_get_ident, METH_NOARGS, get_ident_doc}, - {"_count", (PyCFunction)thread__count, + {"_count", thread__count, METH_NOARGS, _count_doc}, {"stack_size", (PyCFunction)thread_stack_size, METH_VARARGS, stack_size_doc}, - {"_set_sentinel", (PyCFunction)thread__set_sentinel, + {"_set_sentinel", thread__set_sentinel, METH_NOARGS, _set_sentinel_doc}, {NULL, NULL} /* sentinel */ }; diff --git a/Modules/_uuidmodule.c b/Modules/_uuidmodule.c index 16aa09b..3a0c057 100644 --- a/Modules/_uuidmodule.c +++ b/Modules/_uuidmodule.c @@ -10,7 +10,8 @@ static PyObject * -py_uuid_generate_time_safe(void) +py_uuid_generate_time_safe(PyObject *Py_UNUSED(context), + PyObject *Py_UNUSED(ignored)) { uuid_t uuid; #ifdef HAVE_UUID_GENERATE_TIME_SAFE @@ -30,7 +31,7 @@ py_uuid_generate_time_safe(void) static PyMethodDef uuid_methods[] = { - {"generate_time_safe", (PyCFunction) py_uuid_generate_time_safe, METH_NOARGS, NULL}, + {"generate_time_safe", py_uuid_generate_time_safe, METH_NOARGS, NULL}, {NULL, NULL, 0, NULL} /* sentinel */ }; diff --git a/Modules/_xxsubinterpretersmodule.c b/Modules/_xxsubinterpretersmodule.c index 49d3b48..634823a 100644 --- a/Modules/_xxsubinterpretersmodule.c +++ b/Modules/_xxsubinterpretersmodule.c @@ -2171,7 +2171,7 @@ So does an unrecognized ID."); static PyObject * -interp_list_all(PyObject *self) +interp_list_all(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject *ids, *id; PyInterpreterState *interp; @@ -2209,7 +2209,7 @@ Return a list containing the ID of every existing interpreter."); static PyObject * -interp_get_current(PyObject *self) +interp_get_current(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyInterpreterState *interp =_get_current(); if (interp == NULL) { @@ -2225,7 +2225,7 @@ Return the ID of current interpreter."); static PyObject * -interp_get_main(PyObject *self) +interp_get_main(PyObject *self, PyObject *Py_UNUSED(ignored)) { // Currently, 0 is always the main interpreter. return PyLong_FromLongLong(0); @@ -2341,7 +2341,7 @@ PyDoc_STRVAR(is_running_doc, Return whether or not the identified interpreter is running."); static PyObject * -channel_create(PyObject *self) +channel_create(PyObject *self, PyObject *Py_UNUSED(ignored)) { int64_t cid = _channel_create(&_globals.channels); if (cid < 0) { @@ -2389,7 +2389,7 @@ Close and finalize the channel. Afterward attempts to use the channel\n\ will behave as though it never existed."); static PyObject * -channel_list_all(PyObject *self) +channel_list_all(PyObject *self, PyObject *Py_UNUSED(ignored)) { int64_t count = 0; int64_t *cids = _channels_list_all(&_globals.channels, &count); @@ -2546,11 +2546,11 @@ static PyMethodDef module_functions[] = { METH_VARARGS, create_doc}, {"destroy", (PyCFunction)interp_destroy, METH_VARARGS, destroy_doc}, - {"list_all", (PyCFunction)interp_list_all, + {"list_all", interp_list_all, METH_NOARGS, list_all_doc}, - {"get_current", (PyCFunction)interp_get_current, + {"get_current", interp_get_current, METH_NOARGS, get_current_doc}, - {"get_main", (PyCFunction)interp_get_main, + {"get_main", interp_get_main, METH_NOARGS, get_main_doc}, {"is_running", (PyCFunction)interp_is_running, METH_VARARGS, is_running_doc}, @@ -2560,11 +2560,11 @@ static PyMethodDef module_functions[] = { {"is_shareable", (PyCFunction)object_is_shareable, METH_VARARGS, is_shareable_doc}, - {"channel_create", (PyCFunction)channel_create, + {"channel_create", channel_create, METH_NOARGS, channel_create_doc}, {"channel_destroy", (PyCFunction)channel_destroy, METH_VARARGS, channel_destroy_doc}, - {"channel_list_all", (PyCFunction)channel_list_all, + {"channel_list_all", channel_list_all, METH_NOARGS, channel_list_all_doc}, {"channel_send", (PyCFunction)channel_send, METH_VARARGS, channel_send_doc}, diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c index f1da9f7..2f9c2f6 100644 --- a/Modules/faulthandler.c +++ b/Modules/faulthandler.c @@ -533,7 +533,7 @@ faulthandler_disable(void) } static PyObject* -faulthandler_disable_py(PyObject *self) +faulthandler_disable_py(PyObject *self, PyObject *Py_UNUSED(ignored)) { if (!fatal_error.enabled) { Py_RETURN_FALSE; @@ -543,7 +543,7 @@ faulthandler_disable_py(PyObject *self) } static PyObject* -faulthandler_is_enabled(PyObject *self) +faulthandler_is_enabled(PyObject *self, PyObject *Py_UNUSED(ignored)) { return PyBool_FromLong(fatal_error.enabled); } @@ -718,7 +718,8 @@ faulthandler_dump_traceback_later(PyObject *self, } static PyObject* -faulthandler_cancel_dump_traceback_later_py(PyObject *self) +faulthandler_cancel_dump_traceback_later_py(PyObject *self, + PyObject *Py_UNUSED(ignored)) { cancel_dump_traceback_later(); Py_RETURN_NONE; @@ -1116,7 +1117,7 @@ stack_overflow(uintptr_t min_sp, uintptr_t max_sp, size_t *depth) } static PyObject * -faulthandler_stack_overflow(PyObject *self) +faulthandler_stack_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) { size_t depth, size; uintptr_t sp = (uintptr_t)&depth; @@ -1177,9 +1178,9 @@ static PyMethodDef module_methods[] = { (PyCFunction)faulthandler_py_enable, METH_VARARGS|METH_KEYWORDS, PyDoc_STR("enable(file=sys.stderr, all_threads=True): " "enable the fault handler")}, - {"disable", (PyCFunction)faulthandler_disable_py, METH_NOARGS, + {"disable", faulthandler_disable_py, METH_NOARGS, PyDoc_STR("disable(): disable the fault handler")}, - {"is_enabled", (PyCFunction)faulthandler_is_enabled, METH_NOARGS, + {"is_enabled", faulthandler_is_enabled, METH_NOARGS, PyDoc_STR("is_enabled()->bool: check if the handler is enabled")}, {"dump_traceback", (PyCFunction)faulthandler_dump_traceback_py, METH_VARARGS|METH_KEYWORDS, @@ -1194,7 +1195,7 @@ static PyMethodDef module_methods[] = { "or each timeout seconds if repeat is True. If exit is True, " "call _exit(1) which is not safe.")}, {"cancel_dump_traceback_later", - (PyCFunction)faulthandler_cancel_dump_traceback_later_py, METH_NOARGS, + faulthandler_cancel_dump_traceback_later_py, METH_NOARGS, PyDoc_STR("cancel_dump_traceback_later():\ncancel the previous call " "to dump_traceback_later().")}, #endif @@ -1227,7 +1228,7 @@ static PyMethodDef module_methods[] = { {"_fatal_error", faulthandler_fatal_error_py, METH_VARARGS, PyDoc_STR("_fatal_error(message): call Py_FatalError(message)")}, #ifdef FAULTHANDLER_STACK_OVERFLOW - {"_stack_overflow", (PyCFunction)faulthandler_stack_overflow, METH_NOARGS, + {"_stack_overflow", faulthandler_stack_overflow, METH_NOARGS, PyDoc_STR("_stack_overflow(): recursive call to raise a stack overflow")}, #endif #ifdef MS_WINDOWS 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. diff --git a/Modules/nismodule.c b/Modules/nismodule.c index a9028bb..1a538dc 100644 --- a/Modules/nismodule.c +++ b/Modules/nismodule.c @@ -137,7 +137,7 @@ nis_foreach (int instatus, char *inkey, int inkeylen, char *inval, } static PyObject * -nis_get_default_domain (PyObject *self) +nis_get_default_domain (PyObject *self, PyObject *Py_UNUSED(ignored)) { char *domain; int err; @@ -432,7 +432,7 @@ static PyMethodDef nis_methods[] = { {"maps", (PyCFunction)nis_maps, METH_VARARGS | METH_KEYWORDS, maps__doc__}, - {"get_default_domain", (PyCFunction)nis_get_default_domain, + {"get_default_domain", nis_get_default_domain, METH_NOARGS, get_default_domain__doc__}, {NULL, NULL} /* Sentinel */ diff --git a/Modules/overlapped.c b/Modules/overlapped.c index ae7cdda..69875a7 100644 --- a/Modules/overlapped.c +++ b/Modules/overlapped.c @@ -618,7 +618,7 @@ PyDoc_STRVAR( "Cancel overlapped operation"); static PyObject * -Overlapped_cancel(OverlappedObject *self) +Overlapped_cancel(OverlappedObject *self, PyObject *Py_UNUSED(ignored)) { BOOL ret = TRUE; diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index fe2968a..a366d1b 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -1006,7 +1006,7 @@ devpoll_internal_close(devpollObject *self) } static PyObject* -devpoll_close(devpollObject *self) +devpoll_close(devpollObject *self, PyObject *Py_UNUSED(ignored)) { errno = devpoll_internal_close(self); if (errno < 0) { @@ -1032,7 +1032,7 @@ devpoll_get_closed(devpollObject *self) } static PyObject* -devpoll_fileno(devpollObject *self) +devpoll_fileno(devpollObject *self, PyObject *Py_UNUSED(ignored)) { if (self->fd_devpoll < 0) return devpoll_err_closed(); @@ -1327,7 +1327,7 @@ pyepoll_dealloc(pyEpoll_Object *self) } static PyObject* -pyepoll_close(pyEpoll_Object *self) +pyepoll_close(pyEpoll_Object *self, PyObject *Py_UNUSED(ignored)) { errno = pyepoll_internal_close(self); if (errno < 0) { @@ -1353,7 +1353,7 @@ pyepoll_get_closed(pyEpoll_Object *self) } static PyObject* -pyepoll_fileno(pyEpoll_Object *self) +pyepoll_fileno(pyEpoll_Object *self, PyObject *Py_UNUSED(ignored)) { if (self->epfd < 0) return pyepoll_err_closed(); @@ -2053,7 +2053,7 @@ kqueue_queue_dealloc(kqueue_queue_Object *self) } static PyObject* -kqueue_queue_close(kqueue_queue_Object *self) +kqueue_queue_close(kqueue_queue_Object *self, PyObject *Py_UNUSED(ignored)) { errno = kqueue_queue_internal_close(self); if (errno < 0) { @@ -2079,7 +2079,7 @@ kqueue_queue_get_closed(kqueue_queue_Object *self) } static PyObject* -kqueue_queue_fileno(kqueue_queue_Object *self) +kqueue_queue_fileno(kqueue_queue_Object *self, PyObject *Py_UNUSED(ignored)) { if (self->kqfd < 0) return kqueue_queue_err_closed(); diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index c7a0751..3000175 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -2504,7 +2504,7 @@ sock_accept_impl(PySocketSockObject *s, void *data) /* s._accept() -> (fd, address) */ static PyObject * -sock_accept(PySocketSockObject *s) +sock_accept(PySocketSockObject *s, PyObject *Py_UNUSED(ignored)) { sock_addr_t addrbuf; SOCKET_T newfd; @@ -2605,7 +2605,7 @@ setblocking(False) is equivalent to settimeout(0.0)."); False if it is in non-blocking mode. */ static PyObject * -sock_getblocking(PySocketSockObject *s) +sock_getblocking(PySocketSockObject *s, PyObject *Py_UNUSED(ignored)) { if (s->sock_timeout) { Py_RETURN_TRUE; @@ -2717,7 +2717,7 @@ Setting a timeout of zero is the same as setblocking(0)."); /* s.gettimeout() method. Returns the timeout associated with a socket. */ static PyObject * -sock_gettimeout(PySocketSockObject *s) +sock_gettimeout(PySocketSockObject *s, PyObject *Py_UNUSED(ignored)) { if (s->sock_timeout < 0) { Py_RETURN_NONE; @@ -2930,7 +2930,7 @@ sockets the address is a tuple (ifname, proto [,pkttype [,hatype]])"); will surely fail. */ static PyObject * -sock_close(PySocketSockObject *s) +sock_close(PySocketSockObject *s, PyObject *Py_UNUSED(ignored)) { SOCKET_T fd; int res; @@ -2961,7 +2961,7 @@ PyDoc_STRVAR(sock_close_doc, Close the socket. It cannot be used after this call."); static PyObject * -sock_detach(PySocketSockObject *s) +sock_detach(PySocketSockObject *s, PyObject *Py_UNUSED(ignored)) { SOCKET_T fd = s->sock_fd; s->sock_fd = INVALID_SOCKET; @@ -3117,7 +3117,7 @@ instead of raising an exception when an error occurs."); /* s.fileno() method */ static PyObject * -sock_fileno(PySocketSockObject *s) +sock_fileno(PySocketSockObject *s, PyObject *Py_UNUSED(ignored)) { return PyLong_FromSocket_t(s->sock_fd); } @@ -3131,7 +3131,7 @@ Return the integer file descriptor of the socket."); /* s.getsockname() method */ static PyObject * -sock_getsockname(PySocketSockObject *s) +sock_getsockname(PySocketSockObject *s, PyObject *Py_UNUSED(ignored)) { sock_addr_t addrbuf; int res; @@ -3160,7 +3160,7 @@ info is a pair (hostaddr, port)."); /* s.getpeername() method */ static PyObject * -sock_getpeername(PySocketSockObject *s) +sock_getpeername(PySocketSockObject *s, PyObject *Py_UNUSED(ignored)) { sock_addr_t addrbuf; int res; @@ -6390,7 +6390,7 @@ Get host and port for a sockaddr."); /* Python API to getting and setting the default timeout value. */ static PyObject * -socket_getdefaulttimeout(PyObject *self) +socket_getdefaulttimeout(PyObject *self, PyObject *Py_UNUSED(ignored)) { if (defaulttimeout < 0) { Py_RETURN_NONE; @@ -6639,7 +6639,7 @@ static PyMethodDef socket_methods[] = { METH_VARARGS | METH_KEYWORDS, getaddrinfo_doc}, {"getnameinfo", socket_getnameinfo, METH_VARARGS, getnameinfo_doc}, - {"getdefaulttimeout", (PyCFunction)socket_getdefaulttimeout, + {"getdefaulttimeout", socket_getdefaulttimeout, METH_NOARGS, getdefaulttimeout_doc}, {"setdefaulttimeout", socket_setdefaulttimeout, METH_O, setdefaulttimeout_doc}, |