summaryrefslogtreecommitdiff
path: root/numpy/array_api/_statistical_functions.py
diff options
context:
space:
mode:
authorwarren <warren.weckesser@gmail.com>2021-10-10 11:31:09 -0400
committerwarren <warren.weckesser@gmail.com>2021-10-10 21:49:54 -0400
commit0e9e01697a9b3377bd95daf4795995e6682c16fb (patch)
treef48abc9454ae18ba9ce4d5648a2034e1177a7f28 /numpy/array_api/_statistical_functions.py
parent024d64b53e1f4d7e4cf28c9556dd065ef3be4457 (diff)
downloadnumpy-0e9e01697a9b3377bd95daf4795995e6682c16fb.tar.gz
BUG: core: result_type(0, np.timedelta64(4)) would seg. fault.
Before this change, the line in convert_datatype.c result = PyArray_CastDescrToDType(all_descriptors[0], common_dtype); would trigger a seg. fault with a call such as np.result_type(0, np.timedelta64(4)) The problem was that `all_descriptors[0]` was NULL, and it was dereferenced in PyArray_CastDescrToDType. The code in the loop that followed the above line avoided passing NULL values in all_descriptors[i] to PyArray_CastDescrToDType by checking that the corresponding input argument to `result_type` was not a Python scalar. A different code path was taken in that case. The seg. fault is fixed by applying that same check to the first argument. Closes gh-20077.
Diffstat (limited to 'numpy/array_api/_statistical_functions.py')
0 files changed, 0 insertions, 0 deletions