summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/release/1.13.0-notes.rst5
-rw-r--r--numpy/core/src/multiarray/scalartypes.c.src3
-rw-r--r--numpy/core/tests/test_numeric.py3
3 files changed, 2 insertions, 9 deletions
diff --git a/doc/release/1.13.0-notes.rst b/doc/release/1.13.0-notes.rst
index f7aed1913..3123e797d 100644
--- a/doc/release/1.13.0-notes.rst
+++ b/doc/release/1.13.0-notes.rst
@@ -76,11 +76,6 @@ obvious exception of any code that tries to directly call
``ndarray.__getslice__`` (e.g. through ``super(...).__getslice__``). In
this case, ``.__getitem__(slice(start, end))`` will act as a replacement.
-``np.squeeze`` always returns an array when passed a scalar
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Previously, this was only the case when passed a python scalar, and it did not
-do array promotion when passed a numpy scalar.
-
C API
~~~~~
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)