diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2013-03-01 10:37:43 -0800 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2013-03-01 10:37:43 -0800 |
commit | 890ee94dd90769d303025e10d906f584088516d3 (patch) | |
tree | 447198f73f5367a2930f7bedfd10dffa2b4ee0cd | |
parent | d111fbdc1e7da219e4a30b8abd3f710b57116635 (diff) | |
parent | e12dc1cf32daa3e9f19295e985b640e3a04f96ea (diff) | |
download | numpy-890ee94dd90769d303025e10d906f584088516d3.tar.gz |
Merge pull request #3102 from seberg/nditer-fix-op_axes-initialization
BUG: initialize op_axes when only itershape is given
-rw-r--r-- | numpy/core/src/multiarray/nditer_pywrap.c | 2 | ||||
-rw-r--r-- | numpy/core/tests/test_nditer.py | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/nditer_pywrap.c b/numpy/core/src/multiarray/nditer_pywrap.c index fd88cdbc7..4621491a3 100644 --- a/numpy/core/src/multiarray/nditer_pywrap.c +++ b/numpy/core/src/multiarray/nditer_pywrap.c @@ -786,7 +786,7 @@ npyiter_init(NewNpyArrayIterObject *self, PyObject *args, PyObject *kwds) if (itershape.len > 0) { if (oa_ndim == 0) { oa_ndim = itershape.len; - memset(op_axes, 0, sizeof(op_axes[0])*oa_ndim); + memset(op_axes, 0, sizeof(op_axes[0]) * nop); } else if (oa_ndim != itershape.len) { PyErr_SetString(PyExc_ValueError, diff --git a/numpy/core/tests/test_nditer.py b/numpy/core/tests/test_nditer.py index f40ac68a8..92d1149ef 100644 --- a/numpy/core/tests/test_nditer.py +++ b/numpy/core/tests/test_nditer.py @@ -598,6 +598,8 @@ def test_iter_itershape(): [['readonly'], ['writeonly','allocate']], op_axes=[[0,1,None], None], itershape=(-1,1,4)) + # Test bug that for no op_axes but itershape, they are NULLed correctly + i = np.nditer([np.ones(2), None, None], itershape=(2,)) def test_iter_broadcasting_errors(): # Check that errors are thrown for bad broadcasting shapes |