From 2e84d68edbabbefa4be4d9b3812239b6050ef5d9 Mon Sep 17 00:00:00 2001 From: Jeryn Mathew Date: Thu, 6 Feb 2014 13:17:46 +0530 Subject: [PATCH] Fix for issue #693 - Override older behavior of execfile_ with one with pyc patch --- gunicorn/six.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gunicorn/six.py b/gunicorn/six.py index 62c47be7..fc638455 100644 --- a/gunicorn/six.py +++ b/gunicorn/six.py @@ -344,7 +344,7 @@ if PY3: print_ = getattr(builtins, "print") def execfile_(fname, *args): - return exec_(compile(open(fname, 'rb').read(), fname, 'exec'), *args) + return exec_(_get_codeobj(fname), *args) del builtins @@ -367,7 +367,10 @@ else: raise tp, value, tb """) - execfile_ = execfile + def execfile_(fname, *args): + """ Overriding PY2 execfile() implementation to support .pyc files """ + return exec_(_get_codeobj(fname), *args) + def print_(*args, **kwargs): """The new-style print function."""