Skip to content

Commit c59773b

Browse files
committed
Apply review comments
1 parent fed445b commit c59773b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

numpy/_core/fromnumeric.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,10 @@ def reshape(a, /, shape=None, *, newshape=None, order='C', copy=None):
320320
stacklevel=2,
321321
)
322322
shape = newshape
323-
return _wrapfunc(a, 'reshape', shape, order=order, copy=copy)
323+
kwargs = {"order": order}
324+
if copy is not None:
325+
kwargs["copy"] = copy
326+
return _wrapfunc(a, 'reshape', shape, **kwargs)
324327

325328

326329
def _choose_dispatcher(a, choices, out=None, mode=None):

numpy/_core/src/multiarray/shape.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ _reshape_with_copy_arg(PyArrayObject *array, PyArray_Dims *newdims,
248248
if (_fix_unknown_dimension(newdims, array) < 0) {
249249
return NULL;
250250
}
251+
/*
252+
* Memory order doesn't depend on a copy/no-copy context.
253+
* 'order' argument is always honored.
254+
*/
251255
if (copy == NPY_COPY_ALWAYS) {
252256
PyObject *newcopy = PyArray_NewCopy(array, order);
253257
if (newcopy == NULL) {

0 commit comments

Comments
 (0)