BUG: Unify handling of string enum converters#16008
Conversation
numpy/core/tests/test_multiarray.py
Outdated
There was a problem hiding this comment.
This test was actually calling x.flatten(dict(order=...)), which fails no matter what ... is.
This comment has been minimized.
This comment has been minimized.
|
CI failure is unrelated |
seberg
left a comment
There was a problem hiding this comment.
LGTM, not much to discuss about, just some thoughts really. Could also let all the functions return -1, since that is unreachable code right now, that ensures an incorrect error rather than incorrect result if someone edits a converter incorrectly.
There was a problem hiding this comment.
Why the length == 2 its not like it micro-optimizes even, since that would be the error path?
There was a problem hiding this comment.
Because otherwise we allow trailing nulls.
Don't know what you mean by that. |
This fixes a collection of bugs: * Confusion between `TypeError` and `ValueError` * Allowing invalid arguments if they are valid up to the first embedded null * Producing better errors for non-ascii unicode strings
8c67f5e to
35b0a05
Compare
|
Thanks for the patience. The diff looks so unwieldy ;), but the code is much much nicer now. Thanks! |
This uses the helper function added from numpygh-16008, which is renamed and documented to justify its use in a second module. This does not implement the length-checking needed to reject trailing nulls.
Builds upon gh-16007, marking as draft until that's resolved
This fixes a collection of bugs:
TypeErrorandValueError