diff options
| author | Travis Oliphant <oliphant@enthought.com> | 2006-01-12 14:30:37 +0000 |
|---|---|---|
| committer | Travis Oliphant <oliphant@enthought.com> | 2006-01-12 14:30:37 +0000 |
| commit | ece9e80e8eb587ed11958403a34fb8b9de0fdb51 (patch) | |
| tree | 803cc06bda9c84bf4c0052748137353808e58d0c /numpy/core/src/arrayobject.c | |
| parent | 470bc4b47535a4749037661881aad82a44b1fd9b (diff) | |
| download | numpy-ece9e80e8eb587ed11958403a34fb8b9de0fdb51.tar.gz | |
Fix segfault in constructor when dtype not given.
Diffstat (limited to 'numpy/core/src/arrayobject.c')
| -rw-r--r-- | numpy/core/src/arrayobject.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c index 3ea85c692..91c149a41 100644 --- a/numpy/core/src/arrayobject.c +++ b/numpy/core/src/arrayobject.c @@ -3884,15 +3884,20 @@ array_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds) &strides, &fortran)) goto fail; - + + + if (descr == NULL) + descr = PyArray_DescrFromType(PyArray_LONG); + type_num = descr->type_num; - itemsize = descr->elsize; + 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, |
