numpy/numpy — pull request #4431 by meltingwax (2014-03-04 00:26:42+00:00)
Title: BUG: Fix deepcopy() of rank-zero arrays.

Fixes #3311. Removed call to PyArray_Return() on return value.

``PyArray_Return(PyArrayObject*)`` is described as *"Return either an array or the appropriate Python object if the array is 0d and matches a Python type."* The single path out of the ``__deepcopy__`` implementation was: ``return PyArray_Return(ret);``.

The type of the return value of ``__deepcopy__`` on an array should **always** be an array, so there should be no case where ``PyArray_Return`` acts.

Looking at the history of this line, the call was originally added when a developer was adding it to six other method in the file (``git show 2d0b625d``). So it was very likely a mistake. It likely went unnoticed because it has no effect when ndim > 0.