Skip to content

MAINT: Improve error message for legal but unsupported PEP3118 types #12373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 13, 2018

Conversation

eric-wieser
Copy link
Member

@eric-wieser eric-wieser commented Nov 13, 2018

Relates to #12369

Traceback is now:

In [1]: from array import array
   ...: import numpy as np
   ...:
   ...: buf = array('u', ['q', 'w', 'e', 'r', 't'])
   ...: view = memoryview(buf)
   ...:

In [2]: np.array(view)
NotImplementedError: Unrepresentable PEP 3118 data type 'u' (UCS-2 strings)

The above exception was the direct cause of the following exception:

ValueError: 'u' is not a valid PEP 3118 buffer format string

Relates to numpy#12369

Traceback is now:

```
In [1]: from array import array
   ...: import numpy as np
   ...:
   ...: buf = array('u', ['q', 'w', 'e', 'r', 't'])
   ...: view = memoryview(buf)
   ...:

In [2]: np.array(view)
NotImplementedError: Unsupported PEP 3118 data type 'u' (UCS-2 strings)

The above exception was the direct cause of the following exception:

ValueError: 'u' is not a valid PEP 3118 buffer format string
```
@eric-wieser eric-wieser force-pushed the pep3118-better-errors branch from fcecc64 to fc4b477 Compare November 13, 2018 08:35
@charris charris merged commit befaf68 into numpy:master Nov 13, 2018
@charris
Copy link
Member

charris commented Nov 13, 2018

Thanks Eric.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants