Skip to content

Commit cadc292

Browse files
committed
BUG: numpy.einsum indexing arrays now accept numpy int type
See numpy#15961
1 parent 3fd7b70 commit cadc292

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

numpy/core/src/multiarray/multiarraymodule.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2459,9 +2459,10 @@ einsum_list_to_subscripts(PyObject *obj, char *subscripts, int subsize)
24592459
ellipsis = 1;
24602460
}
24612461
else {
2462-
long s = PyLong_AsLong(item);
2462+
item = PyNumber_Index(item);
24632463
/* Subscript */
2464-
if(!PyErr_Occurred()) {
2464+
if(item != NULL) {
2465+
long s = PyLong_AsLong(item);
24652466
npy_bool bad_input = 0;
24662467

24672468
if (subindex + 1 >= subsize) {

0 commit comments

Comments
 (0)