diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2018-05-18 21:34:03 -0700 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2018-09-23 09:25:43 -0700 |
commit | b6e03a44a219e86964a4a08f961811f7ddcca900 (patch) | |
tree | 8875eb93b4efa814104686c8291a5d52916e7c06 /numpy/lib/tests/test_index_tricks.py | |
parent | 1c0ebd808ede34d384a44ed19093afc109ba0cd8 (diff) | |
download | numpy-b6e03a44a219e86964a4a08f961811f7ddcca900.tar.gz |
ENH: Chain exceptions to give better error messages for invalid PEP3118 format strings
Sample console output:
```
In [1]: from ctypes import c_wchar
In [2]: x = c_wchar * 3
In [3]: np.array(x())
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
~\Repos\numeric-python\numpy\build\testenv\Lib\site-packages\numpy\core\_internal.py in _dtype_from_pep3118(spec)
486
--> 487 dtype, align = __dtype_from_pep3118(stream, is_subdtype=False)
488 return dtype
~\Repos\numeric-python\numpy\build\testenv\Lib\site-packages\numpy\core\_internal.py in __dtype_from_pep3118(stream, is_subdtype)
558 else:
--> 559 raise ValueError("Unknown PEP 3118 data type specifier %r" % stream.s)
560
ValueError: Unknown PEP 3118 data type specifier 'u'
The above exception was the direct cause of the following exception:
ValueError Traceback (most recent call last)
<ipython-input-3-f8a17df3aa24> in <module>()
----> 1 np.array(x())
ValueError: '<u' is not a valid PEP 3118 buffer format string
```
Diffstat (limited to 'numpy/lib/tests/test_index_tricks.py')
0 files changed, 0 insertions, 0 deletions