diff options
author | Nathan Goldbaum <nathan.goldbaum@gmail.com> | 2023-01-10 09:55:51 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-10 17:55:51 +0100 |
commit | 737b0647e712853d2b7defd944dde7e4b10cd224 (patch) | |
tree | 5cccee6da3ab853853eebcd23ad57a4fbeedd2b9 /numpy/array_api/_array_object.py | |
parent | df1ee34c7faea1cfc2aef0719444b6fa43887b42 (diff) | |
download | numpy-737b0647e712853d2b7defd944dde7e4b10cd224.tar.gz |
ENH: allow NEP 42 dtypes to work with np.char (#22863)
This makes it possible for new-style NEP 42 string dtypes like ASCIIDType to work with the functions in np.char, this has leads to some mild modification (stricter behavior in bad paths).
It will only work with dtypes with a scalar that subclasses str or bytes. I also assume that you can create instances of the user dtype from python like dtype_instance = CustomDType(size_in_bytes). This is a pretty big assumption about the API of the dtype, I'm not sure offhand how I can do this more portably or more safely.
I also added a new macro, NPY_DT_is_user_defined, which checks dtype->type_num == -1, which is currently true for all custom dtypes using the experimental dtype API. This new macro is needed because NPY_DT_is_legacy will return false for np.void.
This is only tested via the user dtypes currently.
Diffstat (limited to 'numpy/array_api/_array_object.py')
0 files changed, 0 insertions, 0 deletions