Repository navigation
Closed
Labels
Description
Describe the issue:
The code in the next section segfaults reproducibly.
Reproduce the code example:
import numpy as np
a = np.array(['v0', 'v1', 'v2', 'v3'], dtype='T').reshape(2, 2)
a[[0, 1], [0, 1]] = np.array('Z' * 20, dtype='T')Error message:
No error but here's the traceback from lldb:
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
* frame #0: 0x000000018a153504 libsystem_platform.dylib`_platform_memmove + 420
frame #1: 0x0000000105f32f6c _multiarray_umath.cpython-315-darwin.so`NpyString_dup + 324
frame #2: 0x0000000105f316d8 _multiarray_umath.cpython-315-darwin.so`free_and_copy + 76
frame #3: 0x0000000105f2b4b0 _multiarray_umath.cpython-315-darwin.so`string_to_string(PyArrayMethod_Context_tag*, char* const*, long const*, long const*, NpyAuxData_tag*) + 192
frame #4: 0x0000000105e47a3c _multiarray_umath.cpython-315-darwin.so`mapiter_set + 3216
frame #5: 0x0000000105efb81c _multiarray_umath.cpython-315-darwin.so`array_assign_subscript + 2736
frame #6: 0x0000000100910924 libpython3.15.dylib`_PyEval_EvalFrameDefault + 46072
frame #7: 0x0000000100903f28 libpython3.15.dylib`PyEval_EvalCode + 428
frame #8: 0x000000010090068c libpython3.15.dylib`builtin_exec + 1496
frame #9: 0x0000000100907dbc libpython3.15.dylib`_PyEval_EvalFrameDefault + 10384
frame #10: 0x0000000100904160 libpython3.15.dylib`_PyEval_Vector + 508
frame #11: 0x00000001007b6e10 libpython3.15.dylib`_PyVectorcall_Call + 116
frame #12: 0x00000001009aef90 libpython3.15.dylib`_pymain_run_repl + 444
frame #13: 0x00000001009aeb24 libpython3.15.dylib`pymain_run_stdin + 456
frame #14: 0x00000001009ae1d0 libpython3.15.dylib`Py_RunMain + 1952
frame #15: 0x00000001009ae350 libpython3.15.dylib`pymain_main + 324
frame #16: 0x00000001009ae3f4 libpython3.15.dylib`Py_BytesMain + 44
frame #17: 0x0000000189d8be00 dyld`start + 6992Python and NumPy Versions:
Any Python version or recent NumPy version but I reproduced it using 3.15.0b4 and numpy main.
Runtime Environment:
[{'numpy_version': '2.6.0.dev0+git20260730.599cbed',
'python': '3.15.0b4 (main, Jul 19 2026, 10:18:19) [Clang 21.0.0 '
'(clang-2100.1.1.101)]',
'uname': uname_result(system='Darwin', node='Nathans-MBP', release='25.5.0', version='Darwin Kernel Version 25.5.0: Tue Jun 9 22:28:34 PDT 2026; root:xnu-12377.121.10~1/RELEASE_ARM64_T6050', machine='arm64')},
{'simd_extensions': {'baseline': ['NEON', 'NEON_FP16', 'NEON_VFPV4', 'ASIMD'],
'found': ['ASIMDHP', 'ASIMDDP'],
'not_found': ['ASIMDFHM', 'SVE']}},
{'ignore_floating_point_errors_in_matmul': True}]
How does this issue affect you or how did you find it:
A Quansight client reported hitting this segfault.
Activity
ngoldbaum commentedon Jul 30, 2026
There are a number of other issues that have the same cause: the iterator code doesn't handle the fact that array creation might replace a descriptor object and that breaks for StringDType. I have a fix incoming that adds a new helper and tries to globally fix this.
[-]BUG: segfault in stringdtype fancy-index array assignemnt[/-][+]BUG: segfault in stringdtype fancy-index array assignment[/+]