diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2021-06-05 13:34:23 -0500 |
---|---|---|
committer | Sebastian Berg <sebastian@sipsolutions.net> | 2021-06-05 13:59:19 -0500 |
commit | b98ee20e8d10477cc29bce8b595b533de031aec6 (patch) | |
tree | 453c70f3a1f8209eb55eca2011cf42bf2598b236 /numpy/array_api/_creation_functions.py | |
parent | 6790873334b143117f4e8d1f515def8c7fdeb9fb (diff) | |
download | numpy-b98ee20e8d10477cc29bce8b595b533de031aec6.tar.gz |
MAINT,BUG: Adapt `castingimpl.casting` to denote a minimal level
This also allows skipping the call to `resolve_descriptors()` when
the casting level guarantees that the cast will be successfull.
This is sufficient to "tape over" problems with object to string
casts, because it means that an "unsafe" cast is known to work
(no matter the string length).
Note that there is a theoretical anomaly remaining: Casting
object to string without first discovering the correct string length
will fail (because it is unclear which string length to pick), even
though no matter which string length is picked "unsafe" is correct.
NumPy should never do this, we always first discover the string
length when casting from `object` DType specifically (object is
special that way -- not string itself).
In general, this seems fine to me, in practice, the behaviour would
probably not be quite fixed yet.
Diffstat (limited to 'numpy/array_api/_creation_functions.py')
0 files changed, 0 insertions, 0 deletions