diff options
author | sasha <sasha@localhost> | 2006-02-24 20:55:26 +0000 |
---|---|---|
committer | sasha <sasha@localhost> | 2006-02-24 20:55:26 +0000 |
commit | 27e255bc8e5149b5326b4940d33db6d337f89a94 (patch) | |
tree | 4d2458d8b3ede240da65abb227163a30e79b5049 | |
parent | 00f2295ec55239ce35687a20a7c58d1583b068f1 (diff) | |
download | numpy-27e255bc8e5149b5326b4940d33db6d337f89a94.tar.gz |
allow array(())
-rw-r--r-- | numpy/core/src/arrayobject.c | 6 | ||||
-rw-r--r-- | numpy/core/tests/test_multiarray.py | 8 |
2 files changed, 8 insertions, 6 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c index 532daf31b..288071cde 100644 --- a/numpy/core/src/arrayobject.c +++ b/numpy/core/src/arrayobject.c @@ -4142,12 +4142,6 @@ array_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds) type_num = descr->type_num; itemsize = descr->elsize; - if (dims.ptr == NULL) { - PyErr_SetString(PyExc_ValueError, "need to give a "\ - "valid shape as the first argument"); - goto fail; - } - if (buffer.ptr == NULL) { ret = (PyArrayObject *)\ PyArray_NewFromDescr(subtype, descr, diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index e026ee5a0..ff7f25ac0 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -173,6 +173,14 @@ class test_zero_rank(ScipyTestCase): self.failUnlessRaises(IndexError, subscript, a, (newaxis, 0)) self.failUnlessRaises(IndexError, subscript, a, (newaxis,)*50) + def check_constructor(self): + x = ndarray(()) + x[()] = 5 + self.failUnlessEqual(x[()], 5) + y = ndarray((),buffer=x) + y[()] = 6 + self.failUnlessEqual(x[()], 6) + class test_creation(ScipyTestCase): def check_from_attribute(self): class x(object): |