diff options
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/ma.py | 6 | ||||
-rw-r--r-- | numpy/core/src/arrayobject.c | 27 |
2 files changed, 3 insertions, 30 deletions
diff --git a/numpy/core/ma.py b/numpy/core/ma.py index 6231ed5c7..102fecf78 100644 --- a/numpy/core/ma.py +++ b/numpy/core/ma.py @@ -1392,12 +1392,8 @@ array(data = %(data)s, return self._data.ctypes def _get_T(self): - if (self.ndim == 0): + if (self.ndim < 2): return self - if (self.ndim == 1): - ret = self.view() - ret.shape = (self.shape[0], 1) - return ret return self.transpose() shape = property(_get_shape, _set_shape, diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c index f305a9b89..19febf726 100644 --- a/numpy/core/src/arrayobject.c +++ b/numpy/core/src/arrayobject.c @@ -6184,34 +6184,11 @@ array_flat_set(PyArrayObject *self, PyObject *val) static PyObject * array_transpose_get(PyArrayObject *self) { - intp dims[2]; - intp strides[2]; - PyObject *new; - - switch(self->nd) { - case 0: + if (self->nd < 2) { Py_INCREF(self); return (PyObject *)self; - case 1: - dims[0] = self->dimensions[0]; - dims[1] = 1; - strides[0] = self->strides[0]; - strides[1] = 0; - Py_INCREF(self->descr); - new = PyArray_NewFromDescr(self->ob_type, - self->descr, - 2, dims, - strides, - self->data, - self->flags, - (PyObject *)self); - if (new==NULL) return NULL; - Py_INCREF(self); - PyArray_BASE(new) = (PyObject *)self; - return new; - default: - return PyArray_Transpose(self, NULL); } + return PyArray_Transpose(self, NULL); } /* If this is None, no function call is made |