8000 BUG: fix incorrect bytes to stringdtype coercion by charris · Pull Request #28282 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: fix incorrect bytes to stringdtype coercion #28282

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
Feb 5, 2025

Conversation

charris
Copy link
Member
@charris charris commented Feb 5, 2025

Backport of #28276.

Fixes #28269.

It turns out test_scalars_string_conversion was testing the old buggy conversion 🙃.

Is it maybe problematic to assume the bytes are UTF-8? Before we were doing something completely nonsensical so we're free to make a choice here. I think the built-in NumPy bytes dtype assumes everything is ASCII, which is maybe less useful than letting people pass in arbitrary UTF-8?

We could also probably do this faster without going through the Python C API but that can be a future pass if anyone notices.

@charris charris added 00 - Bug 08 - Backport Used to tag backport PRs component: numpy.strings String dtypes and functions labels Feb 5, 2025
@charris charris added this to the 2.2.3 release milestone Feb 5, 2025
@charris charris added 08 - Backport Used to tag backport PRs and removed 08 - Backport Used to tag backport PRs labels Feb 5, 2025
@charris charris merged commit 2cc5acf into numpy:maintenance/2.2.x Feb 5, 2025
68 checks passed
@charris charris deleted the backport-28276 branch February 5, 2025 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
00 - Bug 08 - Backport Used to tag backport PRs component: numpy.strings String dtypes and functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0