From 336cd83062cb112d9d75312f84e50fc1b1996afd 2011-09-09 17:53:49 From: MinRK Date: 2011-09-09 17:53:49 Subject: [PATCH] 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