Skip to content

Commit 39f5ef2

Browse files
committed
MAINT: Check error in Get(Arg)SortFunc using return value
1 parent 6eb14ce commit 39f5ef2

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

numpy/_core/src/multiarray/item_selection.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,9 +1594,7 @@ PyArray_Sort(PyArrayObject *op, int axis, NPY_SORTKIND which)
15941594
return -1;
15951595
}
15961596

1597-
PyArray_GetSortFunction(PyArray_DESCR(op), which, 0, &sort, &auxdata);
1598-
1599-
if (sort == NULL) {
1597+
if (PyArray_GetSortFunction(PyArray_DESCR(op), which, 0, &sort, &auxdata) < 0) {
16001598
sort_with_array = PyDataType_GetArrFuncs(PyArray_DESCR(op))->sort[which];
16011599
}
16021600

@@ -1769,9 +1767,7 @@ PyArray_ArgSort(PyArrayObject *op, int axis, NPY_SORTKIND which)
17691767

17701768
NpyAuxData *auxdata = NULL;
17711769

1772-
PyArray_GetArgSortFunction(PyArray_DESCR(op), which, 0, &argsort, &auxdata);
1773-
1774-
if (argsort == NULL) {
1770+
if (PyArray_GetArgSortFunction(PyArray_DESCR(op), which, 0, &argsort, &auxdata) < 0) {
17751771
argsort_with_array = PyDataType_GetArrFuncs(PyArray_DESCR(op))->argsort[which];
17761772
}
17771773

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy