Skip to content

Commit d0d75f3

Browse files
committed
Reverted dead code removal
1 parent 2db65c9 commit d0d75f3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

numpy/core/src/multiarray/ctors.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1881,7 +1881,16 @@ PyArray_CheckFromAny(PyObject *op, PyArray_Descr *descr, int min_depth,
18811881

18821882
if ((requires & NPY_ARRAY_ELEMENTSTRIDES) &&
18831883
!PyArray_ElementStrides(obj)) {
1884-
PyErr_SetString(PyExc_RuntimeError, "Not Implemented.");
1884+
PyObject *ret;
1885+
if (requires & NPY_ARRAY_ENSURENOCOPY) {
1886+
PyErr_SetString(PyExc_ValueError,
1887+
"Unable to avoid copy "
1888+
"while creating a new array.");
1889+
return NULL;
1890+
}
1891+
ret = PyArray_NewCopy((PyArrayObject *)obj, NPY_ANYORDER);
1892+
Py_DECREF(obj);
1893+
obj = ret;
18851894
}
18861895
return obj;
18871896
}

0 commit comments

Comments
 (0)