You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG: same_kind casting between strings and bytes is inconsistent #32880
I would have expected that the different unicode strings could be casted to each other with "same_kind", but not to and from bytes (since really they are not the same kind). Oddly, however, casting strings to bytes is always possible, but the reverse is not possible for U to S.
@mhvk I think the best we can do for now is deprecate these conversions. Astropy at least relies on them in a few spots. I'll be updating #32757 to start a deprecation cycle for this behavior as well as sending in an AstroPy PRs to no longer rely on implicit bytes/text conversions in NumPy.
Activity
Yvsd1234 commentedon Oct 5, 2026
ananyadas1803git commentedon Oct 11, 2026
ngoldbaum commentedon Oct 13, 2026
This is a very complicated issue and is not a good first issue. Also we don't claim issues and I've hidden the comments above doing that.
ngoldbaum commentedon Oct 13, 2026
@mhvk I think the best we can do for now is deprecate these conversions. Astropy at least relies on them in a few spots. I'll be updating #32757 to start a deprecation cycle for this behavior as well as sending in an AstroPy PRs to no longer rely on implicit bytes/text conversions in NumPy.
mhvk commentedon Oct 14, 2026
@ngoldbaum - yes, that makes sense. This has been the case for long enough that we should go slowly.