diff options
author | Antony Lee <anntzer.lee@gmail.com> | 2019-03-12 17:45:29 +0100 |
---|---|---|
committer | Antony Lee <anntzer.lee@gmail.com> | 2019-03-13 19:42:33 +0100 |
commit | 352b7871a072a51f32bcb6bc1541cabbc447d5c4 (patch) | |
tree | e409abb726713293069ff41564d1f86321d0e213 /numpy/distutils/_shell_utils.py | |
parent | a1d6cf7c319ad89988f03a1478783aaf0630a27c (diff) | |
download | numpy-352b7871a072a51f32bcb6bc1541cabbc447d5c4.tar.gz |
MAINT: Prevent traceback chaining in _wrapfunc.
The traceback of `np.reshape([1, 2, 3], 2)` is shortened from
```
Traceback (most recent call last):
File ".../numpy/core/fromnumeric.py", line 56, in _wrapfunc
return getattr(obj, method)(*args, **kwds)
AttributeError: 'list' object has no attribute 'reshape'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File ".../numpy/core/overrides.py", line 151, in public_api
implementation, public_api, relevant_args, args, kwargs)
File ".../numpy/core/fromnumeric.py", line 296, in reshape
return _wrapfunc(a, 'reshape', newshape, order=order)
File ".../numpy/core/fromnumeric.py", line 66, in _wrapfunc
return _wrapit(obj, method, *args, **kwds)
File ".../numpy/core/fromnumeric.py", line 46, in _wrapit
result = getattr(asarray(obj), method)(*args, **kwds)
ValueError: cannot reshape array of size 3 into shape (2,)
```
to
```
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File ".../numpy/core/overrides.py", line 151, in public_api
implementation, public_api, relevant_args, args, kwargs)
File ".../numpy/core/fromnumeric.py", line 300, in reshape
return _wrapfunc(a, 'reshape', newshape, order=order)
File ".../numpy/core/fromnumeric.py", line 70, in _wrapfunc
return _wrapit(obj, method, *args, **kwds)
File ".../numpy/core/fromnumeric.py", line 46, in _wrapit
result = getattr(asarray(obj), method)(*args, **kwds)
ValueError: cannot reshape array of size 3 into shape (2,)
```
(The chained exception is really just an implementation detail.)
Diffstat (limited to 'numpy/distutils/_shell_utils.py')
0 files changed, 0 insertions, 0 deletions