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: np.fromiter creates corrupted arrays when re-using StringDType instance #32013
When re-using the StringDType instance, np.fromiter creates corrupted arrays leading to flaky failures.
Reproduce the code example:
Reproducer:
>>>np.__version__'2.5.0'>>>sd=np.dtypes.StringDType()
>>>a= ["a"*18, "b"*18]*10_000>>>np.fromiter(iter(a), dtype=sd, count=len(a))
array(['aaaaaaaaaaaaaaaaaa', 'bbbbbbbbbbbbbbbbbb', 'aaaaaaaaaaaaaaaaaa',
..., 'bbbbbbbbbbbbbbbbbb', 'aaaaaaaaaaaaaaaaaa',
'bbbbbbbbbbbbbbbbbb'], shape=(20000,), dtype=StringDType())
>>>np.fromiter(iter(a), dtype=sd, count=len(a)) # same snippet ran for the second time segfaults.FatalPythonerror: Segmentationfault
Activity
[-]BUG: np.fromiter creates corrupted arrays when re-using StringDType instance[/-][+]BUG: `np.fromiter` creates corrupted arrays when re-using StringDType instance[/+]