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.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/numpy/core/overrides.py b/numpy/core/overrides.py
index a12da54b4..bb6d8694a 100644
--- a/numpy/core/overrides.py
+++ b/numpy/core/overrides.py
@@ -157,13 +157,15 @@ def array_function_dispatch(dispatcher, module=None, verify=True,
implementation, {name}, relevant_args, args, kwargs)
""").format(name=implementation.__name__)
+ source_object = compile(
+ source, filename='<__array_function__ internals>', mode='exec')
scope = {
'implementation': implementation,
'dispatcher': dispatcher,
'functools': functools,
'implement_array_function': implement_array_function,
}
- exec(source, scope)
+ exec(source_object, scope)
public_api = scope[implementation.__name__]