diff options
author | Jez Ng <me@jezng.com> | 2014-03-21 16:41:09 -0400 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2014-03-22 18:38:10 -0600 |
commit | 8fbc465f2c13fc29fb1dc945df3440f8e60f8ec7 (patch) | |
tree | f9d98ca536b56dc26956a618980f7fd7ba0da410 | |
parent | 5d36ddcab9c3662f624c24bf6b7ed8d4f1122b60 (diff) | |
download | numpy-8fbc465f2c13fc29fb1dc945df3440f8e60f8ec7.tar.gz |
BUG: fix broken operand initialization for einsum.
Closes #4528.
-rw-r--r-- | numpy/core/src/multiarray/multiarraymodule.c | 2 | ||||
-rw-r--r-- | numpy/core/tests/test_einsum.py | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/multiarraymodule.c b/numpy/core/src/multiarray/multiarraymodule.c index a4c5840bf..efaf1152f 100644 --- a/numpy/core/src/multiarray/multiarraymodule.c +++ b/numpy/core/src/multiarray/multiarraymodule.c @@ -2273,7 +2273,7 @@ einsum_sub_op_from_lists(PyObject *args, /* Set the operands to NULL */ for (i = 0; i < nop; ++i) { - op[nop] = NULL; + op[i] = NULL; } /* Get the operands and build the subscript string */ diff --git a/numpy/core/tests/test_einsum.py b/numpy/core/tests/test_einsum.py index 2e57794a0..555300bbb 100644 --- a/numpy/core/tests/test_einsum.py +++ b/numpy/core/tests/test_einsum.py @@ -31,6 +31,9 @@ class TestEinSum(TestCase): # other keyword arguments are rejected assert_raises(TypeError, np.einsum, "", 0, bad_arg=0) + # issue 4528 revealed a segfault with this call + assert_raises(TypeError, np.einsum, *(None,)*63) + # number of operands must match count in subscripts string assert_raises(ValueError, np.einsum, "", 0, 0) assert_raises(ValueError, np.einsum, ",", 0, [0], [0]) |