summaryrefslogtreecommitdiff
path: root/numpy/doc/basics.py
diff options
context:
space:
mode:
authorAntony Lee <anntzer.lee@gmail.com>2019-03-12 17:45:29 +0100
committerAntony Lee <anntzer.lee@gmail.com>2019-03-13 19:42:33 +0100
commit352b7871a072a51f32bcb6bc1541cabbc447d5c4 (patch)
treee409abb726713293069ff41564d1f86321d0e213 /numpy/doc/basics.py
parenta1d6cf7c319ad89988f03a1478783aaf0630a27c (diff)
downloadnumpy-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/doc/basics.py')
0 files changed, 0 insertions, 0 deletions