diff options
Diffstat (limited to 'numpy/core/_methods.py')
-rw-r--r-- | numpy/core/_methods.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/numpy/core/_methods.py b/numpy/core/_methods.py index 8974f0ce1..baeab6383 100644 --- a/numpy/core/_methods.py +++ b/numpy/core/_methods.py @@ -161,11 +161,8 @@ def _array_function(self, func, types, args, kwargs): # TODO: rewrite this in C # Cannot handle items that have __array_function__ other than our own. for t in types: - if t is not mu.ndarray: - method = getattr(t, '__array_function__', _NDARRAY_ARRAY_FUNCTION) - if method is not _NDARRAY_ARRAY_FUNCTION: - return NotImplemented - - # Arguments contain no overrides, so we can safely call the - # overloaded function again. - return func(*args, **kwargs) + if not issubclass(t, mu.ndarray) and hasattr(t, '__array_function__'): + return NotImplemented + + # The regular implementation can handle this, so we call it directly. + return func.__wrapped__(*args, **kwargs) |