-
-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Closed
Description
Describe the issue:
Seen in pandas-dev/pandas#43941. np.result_type segfaults when the arguments are an int and timedelta64.
Reproduce the code example:
import numpy as np
np.result_type(0, np.timedelta64(4)) # Note that the opposite order doesn't segfault!Error message:
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x8)
frame #0: 0x0000000101381ee3 _multiarray_umath.cpython-38-darwin.so`PyArray_CastDescrToDType + 35
_multiarray_umath.cpython-38-darwin.so`PyArray_CastDescrToDType:
-> 0x101381ee3 <+35>: movq 0x8(%rdi), %rdi
0x101381ee7 <+39>: cmpq %rsi, %rdi
0x101381eea <+42>: je 0x101381f06 ; <+70>
0x101381eec <+44>: cmpb $0x0, 0x379(%rsi)
Target 0: (python) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x8)
* frame #0: 0x0000000101381ee3 _multiarray_umath.cpython-38-darwin.so`PyArray_CastDescrToDType + 35
frame #1: 0x0000000101382eba _multiarray_umath.cpython-38-darwin.so`PyArray_ResultType + 858
frame #2: 0x00000001014589b5 _multiarray_umath.cpython-38-darwin.so`array_result_type + 517
frame #3: 0x000000010002f822 python`cfunction_call_varargs + 194
frame #4: 0x0000000101373bba _multiarray_umath.cpython-38-darwin.so`array_implement_array_function + 234
...NumPy/Python version information:
1.21.2 3.8.12 | packaged by conda-forge | (default, Sep 29 2021, 19:44:33)
[Clang 11.1.0 ]