-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
BUG: Fancy indexing with arrays of uint types fail on StringDType arrays #27710
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
Comments
Thanks for the report! I can reproduce this.
This indicates somehow the array buffer and arena allocation have gone out of sync. Unfortunately there's a long tail of these we've had to deal with because we keep finding places in the NumPy codebase that make (incorrect) assumptions about the output and input dtypes being identical in casts. It's probably another one of those. |
numpy/numpy/_core/src/multiarray/mapping.c Lines 1669 to 1674 in fbffb8c
Like this one. I think making it so that it's not using |
See #27715 |
To add to this and relate to #27737, I get the error even with import numpy as np
str_arr = np.array([["a" * 25]], dtype=np.dtypes.StringDType())
idx = np.array([0], dtype=int)
print(str_arr[idx]) Replacing |
Describe the issue:
When trying to index and array of type StringDType with an array of any unsigned integer type it fails returning a MemoryError (strangely):
MemoryError: Failed to load string in StringDType getitem
MemoryError: String deallocation failed in clear loop
It does work when the index array is cast to int.
Reproduce the code example:
Error message:
Python and NumPy Versions:
Python: 3.10.6
Numpy: 2.1.3
Runtime Environment:
[{'numpy_version': '2.1.3',
'python': '3.10.6 | packaged by conda-forge | (main, Aug 22 2022, 20:36:39) '
'[GCC 10.4.0]',
'uname': uname_result(system='Linux', node='...', release='5.15.133.1-microsoft-standard-WSL2', version='#1 SMP Thu Oct 5 21:02:42 UTC 2023', machine='x86_64')},
{'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
'found': ['SSSE3',
'SSE41',
'POPCNT',
'SSE42',
'AVX',
'F16C',
'FMA3',
'AVX2',
'AVX512F',
'AVX512CD',
'AVX512_SKX',
'AVX512_CLX',
'AVX512_CNL',
'AVX512_ICL'],
'not_found': ['AVX512_KNL', 'AVX512_KNM']}},
{'architecture': 'SkylakeX',
'filepath': 'lib/python3.10/site-packages/numpy.libs/libscipy_openblas64_-ff651d7f.so',
'internal_api': 'openblas',
'num_threads': 16,
'prefix': 'libscipy_openblas',
'threading_layer': 'pthreads',
'user_api': 'blas',
'version': '0.3.27'}]
Context for the issue:
No response
The text was updated successfully, but these errors were encountered: