Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: Fix METH_NOARGS function signatures #20430

Merged
merged 1 commit into from Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion numpy/core/src/multiarray/methods.c
Expand Up @@ -2246,7 +2246,7 @@ array_dumps(PyArrayObject *self, PyObject *args, PyObject *kwds)


static PyObject *
array_sizeof(PyArrayObject *self)
array_sizeof(PyArrayObject *self, PyObject *NPY_UNUSED(args))
{
/* object + dimension and strides */
Py_ssize_t nbytes = Py_TYPE(self)->tp_basicsize +
Expand Down
2 changes: 1 addition & 1 deletion numpy/core/src/multiarray/multiarraymodule.c
Expand Up @@ -4212,7 +4212,7 @@ normalize_axis_index(PyObject *NPY_UNUSED(self),


static PyObject *
_reload_guard(PyObject *NPY_UNUSED(self)) {
_reload_guard(PyObject *NPY_UNUSED(self), PyObject *NPY_UNUSED(args)) {
static int initialized = 0;

#if !defined(PYPY_VERSION)
Expand Down
20 changes: 11 additions & 9 deletions numpy/core/src/multiarray/nditer_pywrap.c
Expand Up @@ -1190,7 +1190,7 @@ npyiter_resetbasepointers(NewNpyArrayIterObject *self)
}

static PyObject *
npyiter_reset(NewNpyArrayIterObject *self)
npyiter_reset(NewNpyArrayIterObject *self, PyObject *NPY_UNUSED(args))
{
if (self->iter == NULL) {
PyErr_SetString(PyExc_ValueError,
Expand Down Expand Up @@ -1227,7 +1227,7 @@ npyiter_reset(NewNpyArrayIterObject *self)
* copied.
*/
static PyObject *
npyiter_copy(NewNpyArrayIterObject *self)
npyiter_copy(NewNpyArrayIterObject *self, PyObject *NPY_UNUSED(args))
{
NewNpyArrayIterObject *iter;

Expand Down Expand Up @@ -1263,7 +1263,7 @@ npyiter_copy(NewNpyArrayIterObject *self)
}

static PyObject *
npyiter_iternext(NewNpyArrayIterObject *self)
npyiter_iternext(NewNpyArrayIterObject *self, PyObject *NPY_UNUSED(args))
{
if (self->iter != NULL && self->iternext != NULL &&
!self->finished && self->iternext(self->iter)) {
Expand Down Expand Up @@ -1320,7 +1320,8 @@ npyiter_remove_axis(NewNpyArrayIterObject *self, PyObject *args)
}

static PyObject *
npyiter_remove_multi_index(NewNpyArrayIterObject *self)
npyiter_remove_multi_index(
NewNpyArrayIterObject *self, PyObject *NPY_UNUSED(args))
{
if (self->iter == NULL) {
PyErr_SetString(PyExc_ValueError,
Expand All @@ -1345,7 +1346,8 @@ npyiter_remove_multi_index(NewNpyArrayIterObject *self)
}

static PyObject *
npyiter_enable_external_loop(NewNpyArrayIterObject *self)
npyiter_enable_external_loop(
NewNpyArrayIterObject *self, PyObject *NPY_UNUSED(args))
{
if (self->iter == NULL) {
PyErr_SetString(PyExc_ValueError,
Expand All @@ -1370,7 +1372,7 @@ npyiter_enable_external_loop(NewNpyArrayIterObject *self)
}

static PyObject *
npyiter_debug_print(NewNpyArrayIterObject *self)
npyiter_debug_print(NewNpyArrayIterObject *self, PyObject *NPY_UNUSED(args))
{
if (self->iter != NULL) {
NpyIter_DebugPrint(self->iter);
Expand Down Expand Up @@ -2315,7 +2317,7 @@ npyiter_ass_subscript(NewNpyArrayIterObject *self, PyObject *op,
}

static PyObject *
npyiter_enter(NewNpyArrayIterObject *self)
npyiter_enter(NewNpyArrayIterObject *self, PyObject *NPY_UNUSED(args))
{
if (self->iter == NULL) {
PyErr_SetString(PyExc_RuntimeError, "operation on non-initialized iterator");
Expand All @@ -2326,7 +2328,7 @@ npyiter_enter(NewNpyArrayIterObject *self)
}

static PyObject *
npyiter_close(NewNpyArrayIterObject *self)
npyiter_close(NewNpyArrayIterObject *self, PyObject *NPY_UNUSED(args))
{
NpyIter *iter = self->iter;
int ret;
Expand All @@ -2347,7 +2349,7 @@ static PyObject *
npyiter_exit(NewNpyArrayIterObject *self, PyObject *NPY_UNUSED(args))
{
/* even if called via exception handling, writeback any data */
return npyiter_close(self);
return npyiter_close(self, NULL);
}

static PyMethodDef npyiter_methods[] = {
Expand Down
10 changes: 5 additions & 5 deletions numpy/core/src/multiarray/scalartypes.c.src
Expand Up @@ -229,7 +229,7 @@ gentype_multiply(PyObject *m1, PyObject *m2)
* #convert = Long*8, LongLong*2#
*/
static PyObject *
@type@_bit_count(PyObject *self)
@type@_bit_count(PyObject *self, PyObject *NPY_UNUSED(args))
{
@type@ scalar = PyArrayScalar_VAL(self, @Name@);
uint8_t count = npy_popcount@c@(scalar);
Expand Down Expand Up @@ -1160,7 +1160,7 @@ gentype_size_get(PyObject *NPY_UNUSED(self), void *NPY_UNUSED(ignored))
}

static PyObject *
gentype_sizeof(PyObject *self)
gentype_sizeof(PyObject *self, PyObject *NPY_UNUSED(args))
{
Py_ssize_t nbytes;
PyObject * isz = gentype_itemsize_get(self, NULL);
Expand Down Expand Up @@ -1918,7 +1918,7 @@ static PyObject *
*/
/* Heavily copied from the builtin float.as_integer_ratio */
static PyObject *
@name@_as_integer_ratio(PyObject *self)
@name@_as_integer_ratio(PyObject *self, PyObject *NPY_UNUSED(args))
{
#if @is_half@
npy_double val = npy_half_to_double(PyArrayScalar_VAL(self, @Name@));
Expand Down Expand Up @@ -1999,7 +1999,7 @@ error:
* #c = f, f, , l#
*/
static PyObject *
@name@_is_integer(PyObject *self)
@name@_is_integer(PyObject *self, PyObject *NPY_UNUSED(args))
{
#if @is_half@
npy_double val = npy_half_to_double(PyArrayScalar_VAL(self, @Name@));
Expand All @@ -2022,7 +2022,7 @@ static PyObject *
/**end repeat**/

static PyObject *
integer_is_integer(PyObject *self) {
integer_is_integer(PyObject *self, PyObject *NPY_UNUSED(args)) {
Py_RETURN_TRUE;
}

Expand Down