diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2017-02-12 12:27:02 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-12 12:27:02 -0700 |
commit | 6f5b96929928b298dc7038659ca74e2c335e8b75 (patch) | |
tree | 93dbb4f557b3220b750178f2e0ff489c87b8a960 /numpy/core | |
parent | a9d694168eedc6fb433688d2265de4e196ed87d5 (diff) | |
parent | d9d266ada4d90fb87b61773bb760e8e7e5bb6ba9 (diff) | |
download | numpy-6f5b96929928b298dc7038659ca74e2c335e8b75.tar.gz |
Merge pull request #8610 from charris/revert-8591
Revert "BUG: make np.squeeze always return an array, never a scalar"
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/src/multiarray/scalartypes.c.src | 3 | ||||
-rw-r--r-- | numpy/core/tests/test_numeric.py | 3 |
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) |