Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion numpy/core/src/multiarray/item_selection.c
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,7 @@ PyArray_Choose(PyArrayObject *ip, PyObject *op, PyArrayObject *out,
PyArrayObject **mps, *ap;
PyArrayMultiIterObject *multi = NULL;
npy_intp mi;
NPY_cast_info cast_info = {.func = NULL};
ap = NULL;

/*
Expand Down Expand Up @@ -1045,7 +1046,6 @@ PyArray_Choose(PyArrayObject *ip, PyObject *op, PyArrayObject *out,
npy_intp transfer_strides[2] = {elsize, elsize};
npy_intp one = 1;
NPY_ARRAYMETHOD_FLAGS transfer_flags = 0;
NPY_cast_info cast_info = {.func = NULL};
if (PyDataType_REFCHK(dtype)) {
int is_aligned = IsUintAligned(obj);
PyArray_GetDTypeTransferFunction(
Expand Down
6 changes: 6 additions & 0 deletions numpy/core/tests/test_multiarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -10042,3 +10042,9 @@ def test_gh_22683():
np.choose(np.zeros(10000, dtype=int), [a], out=a)
refc_end = sys.getrefcount(b)
assert refc_end - refc_start < 10


def test_gh_24459():
a = np.zeros((50, 3), dtype=np.float64)
with pytest.raises(TypeError):
np.choose(a, [3, -1])