summaryrefslogtreecommitdiff
path: root/numpy/core/overrides.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/overrides.py')
-rw-r--r--numpy/core/overrides.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/numpy/core/overrides.py b/numpy/core/overrides.py
index 8f7676f66..06e005102 100644
--- a/numpy/core/overrides.py
+++ b/numpy/core/overrides.py
@@ -26,6 +26,9 @@ def get_overloaded_types_and_args(relevant_args):
overloaded_types.append(arg_type)
if array_function is not ndarray.__array_function__:
+ # By default, insert this argument at the end, but if it is
+ # subclass of another argument, insert it before that argument.
+ # This ensures "subclasses before superclasses".
index = len(overloaded_args)
for i, old_arg in enumerate(overloaded_args):
if issubclass(arg_type, type(old_arg)):