diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cf88d9266d..2bb33ea4805 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ Also, that release drops support for Python 3.9, making Python 3.10 the minimum * Dropped support for Python 3.9 [#2626](https://github.com/IntelPython/dpnp/pull/2626) * Removed the obsolete interface from DPNP to Numba JIT [#2647](https://github.com/IntelPython/dpnp/pull/2647) +* Removed the `newshape` parameter from `dpnp.reshape`, which has been deprecated since dpnp 0.17.0. Pass it positionally or use `shape=` on newer versions [#2670](https://github.com/IntelPython/dpnp/pull/2670) ### Fixed diff --git a/dpnp/dpnp_iface_manipulation.py b/dpnp/dpnp_iface_manipulation.py index d56c8ebbf5e..cfd0bdca637 100644 --- a/dpnp/dpnp_iface_manipulation.py +++ b/dpnp/dpnp_iface_manipulation.py @@ -3013,7 +3013,7 @@ def require(a, dtype=None, requirements=None, *, like=None): return arr -def reshape(a, /, shape=None, order="C", *, newshape=None, copy=None): +def reshape(a, /, shape=None, order="C", *, copy=None): """ Gives a new shape to an array without changing its data. @@ -3045,10 +3045,6 @@ def reshape(a, /, shape=None, order="C", *, newshape=None, copy=None): Fortran *contiguous* in memory, C-like order otherwise. Default: ``"C"``. - newshape : int or tuple of ints - Replaced by `shape` argument. Retained for backward compatibility. - - Default: ``None``. copy : {None, bool}, optional If ``True``, then the array data is copied. If ``None``, a copy will only be made if it's required by ``order``. For ``False`` it raises @@ -3117,27 +3113,11 @@ def reshape(a, /, shape=None, order="C", *, newshape=None, copy=None): """ - if newshape is None and shape is None: + if shape is None: raise TypeError( "reshape() missing 1 required positional argument: 'shape'" ) - if newshape is not None: - if shape is not None: - raise TypeError( - "You cannot specify 'newshape' and 'shape' arguments " - "at the same time." - ) - # Deprecated in dpnp 0.17.0 - warnings.warn( - "`newshape` keyword argument is deprecated, " - "use `shape=...` or pass shape positionally instead. " - "(deprecated in dpnp 0.17.0)", - DeprecationWarning, - stacklevel=2, - ) - shape = newshape - if order is None: order = "C" elif order in "aA": diff --git a/dpnp/tests/test_manipulation.py b/dpnp/tests/test_manipulation.py index 25ac9445aaf..373817466f5 100644 --- a/dpnp/tests/test_manipulation.py +++ b/dpnp/tests/test_manipulation.py @@ -1124,21 +1124,6 @@ def test_copy(self): class TestReshape: - def test_error(self): - ia = dpnp.arange(10) - assert_raises(TypeError, dpnp.reshape, ia) - assert_raises( - TypeError, dpnp.reshape, ia, shape=(2, 5), newshape=(2, 5) - ) - - @pytest.mark.filterwarnings("ignore::DeprecationWarning") - def test_newshape(self): - a = numpy.arange(10) - ia = dpnp.array(a) - expected = numpy.reshape(a, (2, 5)) - result = dpnp.reshape(ia, newshape=(2, 5)) - assert_array_equal(result, expected) - @pytest.mark.parametrize("order", [None, "C", "F", "A"]) def test_order(self, order): a = numpy.arange(10)