diff options
author | Tyler Reddy <tyler.je.reddy@gmail.com> | 2018-03-30 08:32:27 -0600 |
---|---|---|
committer | Tyler Reddy <tyler.je.reddy@gmail.com> | 2018-03-30 08:32:27 -0600 |
commit | 2ee7c72e56b5ef16f3838f86de8ad0d435b9b4e0 (patch) | |
tree | e53541c4ac22ca411b65dba434e2e6b2f81a037e /numpy/core/fromnumeric.py | |
parent | bea761424753c0612a65a6a91d44f9a81bdc4c12 (diff) | |
download | numpy-2ee7c72e56b5ef16f3838f86de8ad0d435b9b4e0.tar.gz |
BUG: np.squeeze() now respects older API axis expectation
* Fixes Issue #10779 by removing the interception of
an otherwise normal Exception when an object implemented
with the expectation that squeeze() does not accept an
axis argument receives an axis argument
* Added unit tests that enforce respect for the old API
expectation in objects, and ensure that silent success
(or forced usage of the new API on objects) is no longer
the case
* Updated compatibility notes to explain this change
Diffstat (limited to 'numpy/core/fromnumeric.py')
-rw-r--r-- | numpy/core/fromnumeric.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py index 10256c3c0..e81a4a039 100644 --- a/numpy/core/fromnumeric.py +++ b/numpy/core/fromnumeric.py @@ -1276,13 +1276,10 @@ def squeeze(a, axis=None): squeeze = a.squeeze except AttributeError: return _wrapit(a, 'squeeze') - try: - # First try to use the new axis= parameter - return squeeze(axis=axis) - except TypeError: - # For backwards compatibility + if axis is None: return squeeze() - + else: + return squeeze(axis=axis) def diagonal(a, offset=0, axis1=0, axis2=1): """ |