summaryrefslogtreecommitdiff
path: root/numpy/core/src/arrayobject.c
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-02-28 21:58:27 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-02-28 21:58:27 +0000
commit931a4a355aeb3a5f272af91258b848e81114febb (patch)
treef7534413ef18255c6654307b516bcfb83c0f40fd /numpy/core/src/arrayobject.c
parentf4fc0196c348b52417ddc546c8a43ef946ae7f8a (diff)
downloadnumpy-931a4a355aeb3a5f272af91258b848e81114febb.tar.gz
Code cleanup
Diffstat (limited to 'numpy/core/src/arrayobject.c')
-rw-r--r--numpy/core/src/arrayobject.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c
index 1cca1eebe..55abc36f0 100644
--- a/numpy/core/src/arrayobject.c
+++ b/numpy/core/src/arrayobject.c
@@ -4147,7 +4147,6 @@ array_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
longlong offset=0;
int fortran = 0;
PyArrayObject *ret;
- intp nb, off;
buffer.ptr = NULL;
/* Usually called with shape and type
@@ -4185,36 +4184,35 @@ array_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
}
if (strides.ptr != NULL) {
+ intp nb, off;
if (strides.len != dims.len) {
PyErr_SetString(PyExc_ValueError,
"strides, if given, must be " \
"the same length as shape");
goto fail;
}
- }
- if (buffer.ptr == NULL) {
- nb = 0;
- off = 0;
- }
- else {
- nb = buffer.len;
- off = offset;
- }
-
+ if (buffer.ptr == NULL) {
+ nb = 0;
+ off = 0;
+ }
+ else {
+ nb = buffer.len;
+ off = offset;
+ }
+
- if (strides.ptr && \
- !PyArray_CheckStrides(itemsize, dims.len,
- nb, off,
- dims.ptr, strides.ptr)) {
- PyErr_SetString(PyExc_ValueError,
- "strides is incompatible " \
- "with shape of requested " \
- "array and size of buffer");
- goto fail;
+ if (!PyArray_CheckStrides(itemsize, dims.len,
+ nb, off,
+ dims.ptr, strides.ptr)) {
+ PyErr_SetString(PyExc_ValueError,
+ "strides is incompatible " \
+ "with shape of requested " \
+ "array and size of buffer");
+ goto fail;
+ }
}
-
-
+
if (buffer.ptr == NULL) {
ret = (PyArrayObject *) \
PyArray_NewFromDescr(subtype, descr,