From e8613d227189abb542712d4765594b30045db70a 2011-09-09 19:12:32 From: Min RK Date: 2011-09-09 19:12:32 Subject: [PATCH] Merge pull request #778 from minrk/execfile don't override execfile on Python 2 --- diff --git a/IPython/utils/py3compat.py b/IPython/utils/py3compat.py index 2e59ddc..6ece377 100644 --- a/IPython/utils/py3compat.py +++ b/IPython/utils/py3compat.py @@ -46,6 +46,10 @@ if sys.version_info[0] >= 3: open = orig_open MethodType = types.MethodType + + def execfile(fname, glob, loc=None): + loc = loc if (loc is not None) else glob + exec compile(open(fname).read(), fname, 'exec') in glob, loc else: PY3 = False @@ -89,7 +93,7 @@ else: def MethodType(func, instance): return types.MethodType(func, instance, type(instance)) + + # don't override system execfile on 2.x: + execfile = execfile -def execfile(fname, glob, loc=None): - loc = loc if (loc is not None) else glob - exec compile(open(fname).read(), fname, 'exec') in glob, loc