summaryrefslogtreecommitdiff
path: root/numpy/core
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2017-02-12 11:43:39 -0700
committerCharles Harris <charlesr.harris@gmail.com>2017-02-12 11:43:39 -0700
commitd9d266ada4d90fb87b61773bb760e8e7e5bb6ba9 (patch)
tree93dbb4f557b3220b750178f2e0ff489c87b8a960 /numpy/core
parenta9d694168eedc6fb433688d2265de4e196ed87d5 (diff)
downloadnumpy-d9d266ada4d90fb87b61773bb760e8e7e5bb6ba9.tar.gz
Revert "BUG: make np.squeeze always return an array, never a scalar"
This reverts commit fa040cada9e832a6d23f359a4029953d14acca0a. This change broke Pandas, and after consideration it has been decided that the more correct change would be squeeze(<a scalar>) returns the original scalar.
Diffstat (limited to 'numpy/core')
-rw-r--r--numpy/core/src/multiarray/scalartypes.c.src3
-rw-r--r--numpy/core/tests/test_numeric.py3
2 files changed, 2 insertions, 4 deletions
diff --git a/numpy/core/src/multiarray/scalartypes.c.src b/numpy/core/src/multiarray/scalartypes.c.src
index db7cad21b..f85e3b828 100644
--- a/numpy/core/src/multiarray/scalartypes.c.src
+++ b/numpy/core/src/multiarray/scalartypes.c.src
@@ -1579,7 +1579,8 @@ gentype_squeeze(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "")) {
return NULL;
}
- return PyArray_FromScalar(self, NULL);
+ Py_INCREF(self);
+ return self;
}
static Py_ssize_t
diff --git a/numpy/core/tests/test_numeric.py b/numpy/core/tests/test_numeric.py
index 919e49061..4aa6bed33 100644
--- a/numpy/core/tests/test_numeric.py
+++ b/numpy/core/tests/test_numeric.py
@@ -147,9 +147,6 @@ class TestNonarrayArgs(TestCase):
A = [[[1, 1, 1], [2, 2, 2], [3, 3, 3]]]
assert_(np.squeeze(A).shape == (3, 3))
- assert_(isinstance(np.squeeze(1), np.ndarray))
- assert_(isinstance(np.squeeze(np.int32(1)), np.ndarray))
-
def test_std(self):
A = [[1, 2, 3], [4, 5, 6]]
assert_almost_equal(np.std(A), 1.707825127659933)