-
-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Closed
Labels
Milestone
Description
Converting an object array containing empty bytestrings to dtype="S" (unknown-size binary string) replaces some, or occasionally all, elements with size-one bytestrings - presumably whatever happened to be in memory at that location.
This seems like a pretty bad bug to me, and has led to failing CI for HypothesisWorks/hypothesis#3682 (logs).
Reproducing example:
import numpy as np
arr = np.array([b"", b""], dtype=object)
print(arr)
new = arr.astype("S") # unsized bytestring
print(new)
print(new.astype(object))[b'' b'']
[b'' b'\x04']
[b'' b'\x04']Runtime information:
WARNING: `threadpoolctl` not found in system! Install it by `pip install threadpoolctl`. Once installed, try `np.show_runtime` again for more detailed build information
[{'numpy_version': '1.25.0',
'python': '3.10.11 (main, Apr 25 2023, 20:05:52) [GCC 9.3.0]',
'uname': uname_result(system='Linux', ..., 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']}}]
Reactions are currently unavailable