summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2021-03-26 11:59:02 -0600
committerGitHub <noreply@github.com>2021-03-26 11:59:02 -0600
commit9afc58010f7027711b22e2eea9e97c2940262928 (patch)
tree177ca88f81f3ad9500ce6ce812a2203437bd8a10
parent5ebc656271c2232a6cb7dc96ad63e8eeed3783fd (diff)
parent14e4812e08348da47dec76940498813870f3b1ba (diff)
downloadnumpy-9afc58010f7027711b22e2eea9e97c2940262928.tar.gz
Merge pull request #18679 from mrios1999/main
BUG: Changed METH_VARARGS to METH_NOARGS
-rw-r--r--numpy/core/src/multiarray/nditer_pywrap.c2
-rw-r--r--numpy/core/tests/test_nditer.py4
2 files changed, 5 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/nditer_pywrap.c b/numpy/core/src/multiarray/nditer_pywrap.c
index e0ec9d5cf..5ac0f8442 100644
--- a/numpy/core/src/multiarray/nditer_pywrap.c
+++ b/numpy/core/src/multiarray/nditer_pywrap.c
@@ -2369,7 +2369,7 @@ static PyMethodDef npyiter_methods[] = {
{"__exit__", (PyCFunction)npyiter_exit,
METH_VARARGS, NULL},
{"close", (PyCFunction)npyiter_close,
- METH_VARARGS, NULL},
+ METH_NOARGS, NULL},
{NULL, NULL, 0, NULL},
};
diff --git a/numpy/core/tests/test_nditer.py b/numpy/core/tests/test_nditer.py
index 82ba5a01b..ddcc8f283 100644
--- a/numpy/core/tests/test_nditer.py
+++ b/numpy/core/tests/test_nditer.py
@@ -3065,6 +3065,10 @@ def test_close_raises():
assert_raises(StopIteration, next, it)
assert_raises(ValueError, getattr, it, 'operands')
+def test_close_parameters():
+ it = np.nditer(np.arange(3))
+ assert_raises(TypeError, it.close, 1)
+
@pytest.mark.skipif(not HAS_REFCOUNT, reason="Python lacks refcounts")
def test_warn_noclose():
a = np.arange(6, dtype='f4')