Skip to content

Commit 87e3010

Browse files
committed
Make (type,()) return type
1 parent d6c1b18 commit 87e3010

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎numpy/core/src/multiarraymodule.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4249,9 +4249,10 @@ _convert_from_tuple(PyObject *obj)
42494249
"invalid shape in fixed-type tuple.");
42504250
goto fail;
42514251
}
4252-
/* If (type, 1) was given, it is equivalent to type... */
4253-
if (shape.len == 1 && shape.ptr[0] == 1 && \
4254-
PyNumber_Check(val)) {
4252+
/* If (type, 1) was given, it is equivalent to type...
4253+
or (type, ()) was given it is equivalent to type... */
4254+
if ((shape.len == 1 && shape.ptr[0] == 1 && PyNumber_Check(val)) || \
4255+
(shape.len == 0 && PyTuple_Check(val))) {
42554256
PyDimMem_FREE(shape.ptr);
42564257
return type;
42574258
}

0 commit comments

Comments
 (0)