summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/lib/index_tricks.py2
-rw-r--r--numpy/lib/tests/test_index_tricks.py5
2 files changed, 6 insertions, 1 deletions
diff --git a/numpy/lib/index_tricks.py b/numpy/lib/index_tricks.py
index 8777de485..cece2b868 100644
--- a/numpy/lib/index_tricks.py
+++ b/numpy/lib/index_tricks.py
@@ -308,7 +308,7 @@ class AxisConcatenator(object):
raise ValueError("unknown special directive")
elif type(item) in ScalarType:
newobj = array(item, ndmin=ndmin)
- scalars.append(k)
+ scalars.append(len(objs))
scalar = True
scalartypes.append(newobj.dtype)
else:
diff --git a/numpy/lib/tests/test_index_tricks.py b/numpy/lib/tests/test_index_tricks.py
index 708c3c964..5b791026b 100644
--- a/numpy/lib/tests/test_index_tricks.py
+++ b/numpy/lib/tests/test_index_tricks.py
@@ -189,6 +189,11 @@ class TestConcatenator(TestCase):
assert_raises(ValueError, lambda: np.r_['rc', a, b])
+ def test_matrix_scalar(self):
+ r = np.r_['r', [1, 2], 3]
+ assert_equal(type(r), np.matrix)
+ assert_equal(np.array(r), [[1,2,3]])
+
def test_matrix_builder(self):
a = np.array([1])
b = np.array([2])