Skip to content

Commit 8bd8d9b

Browse files
committed
Apply review comments
1 parent cd6c036 commit 8bd8d9b

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

numpy/_core/fromnumeric.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -307,11 +307,11 @@ def reshape(a, /, shape=None, *, newshape=None, order='C', copy=None):
307307
if newshape is None and shape is None:
308308
raise TypeError(
309309
"reshape() missing 1 required positional argument: 'shape'")
310-
if newshape is not None and shape is not None:
311-
raise ValueError(
312-
"You cannot specify 'newshape' and 'shape' arguments "
313-
"at the same time.")
314310
if newshape is not None:
311+
if shape is not None:
312+
raise TypeError(
313+
"You cannot specify 'newshape' and 'shape' arguments "
314+
"at the same time.")
315315
# Deprecated in NumPy 2.1, 2024-04-18
316316
warnings.warn(
317317
"`newshape` keyword argument is deprecated, "
@@ -321,10 +321,9 @@ def reshape(a, /, shape=None, *, newshape=None, order='C', copy=None):
321321
stacklevel=2,
322322
)
323323
shape = newshape
324-
kwargs = {"order": order}
325324
if copy is not None:
326-
kwargs["copy"] = copy
327-
return _wrapfunc(a, 'reshape', shape, **kwargs)
325+
return _wrapfunc(a, 'reshape', shape, order=order, copy=copy)
326+
return _wrapfunc(a, 'reshape', shape, order=order)
328327

329328

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

0 commit comments

Comments
 (0)