summaryrefslogtreecommitdiff
path: root/numpy/core/overrides.py
diff options
context:
space:
mode:
authorStephan Hoyer <shoyer@google.com>2019-05-11 12:44:54 -0700
committerStephan Hoyer <shoyer@google.com>2019-05-11 12:44:54 -0700
commit9055d2175f1dc509aa3025ea01546e6de689277f (patch)
tree909c17ee32861845f86629da7f22336ccafccc6b /numpy/core/overrides.py
parent34bca67c9c918e90db4b33336a1d9ed2a57350d4 (diff)
downloadnumpy-9055d2175f1dc509aa3025ea01546e6de689277f.tar.gz
ENH: invent a better fake filename than '<string'>
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__]