diff options
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/scalartypes.inc.src | 2 | ||||
-rw-r--r-- | numpy/lib/tests/test_shape_base.py | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/numpy/core/src/scalartypes.inc.src b/numpy/core/src/scalartypes.inc.src index 52c266232..2a2dffd6c 100644 --- a/numpy/core/src/scalartypes.inc.src +++ b/numpy/core/src/scalartypes.inc.src @@ -1764,7 +1764,7 @@ static PyObject * robj = PyArray_Return((PyArrayObject *)arr); finish: - if (robj->ob_type == type) return robj; + if ((robj==NULL) || (robj->ob_type == type)) return robj; /* Need to allocate new type and copy data-area over */ if (type->tp_itemsize) { itemsize = PyString_GET_SIZE(robj); diff --git a/numpy/lib/tests/test_shape_base.py b/numpy/lib/tests/test_shape_base.py index a96b4fc2c..6efd2cdf1 100644 --- a/numpy/lib/tests/test_shape_base.py +++ b/numpy/lib/tests/test_shape_base.py @@ -381,11 +381,12 @@ class test_tile(NumpyTestCase): assert_equal(tile(a,(1,2)), [[0,1,2,0,1,2]]) assert_equal(tile(b, 2), [[1,2,1,2],[3,4,3,4]]) assert_equal(tile(b,(2,1)),[[1,2],[3,4],[1,2],[3,4]]) - assert_equal(tile(b,(2,2)),[[1,2,1,2],[3,4,3,4],[1,2,1,2],[3,4,3,4]]) + assert_equal(tile(b,(2,2)),[[1,2,1,2],[3,4,3,4], + [1,2,1,2],[3,4,3,4]]) def check_kroncompare(self): import numpy.random as nr - reps=[(2,),(1,2),(2,1),(2,2),(2,3,2),(3,2)] + reps=[(2,),(1,2),(2,1),(2,2),(2,3,2),(3,2)] shape=[(3,),(2,3),(3,4,3),(3,2,3),(4,3,2,4),(2,2)] for s in shape: b = nr.randint(0,10,size=s) @@ -404,3 +405,4 @@ def compare_results(res,desired): if __name__ == "__main__": NumpyTest().run() + |