mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Merge pull request #789 from benoitc/fix/787
fix #787 check if we load a pyc file or not.
This commit is contained in:
commit
42c16b17d1
@ -357,7 +357,11 @@ if PY3:
|
||||
print_ = getattr(builtins, "print")
|
||||
|
||||
def execfile_(fname, *args):
|
||||
return exec_(_get_codeobj(fname), *args)
|
||||
if fname.endswith(".pyc"):
|
||||
code = _get_codeobj(fname)
|
||||
else:
|
||||
code = compile(open(fname, 'rb').read(), fname, 'exec')
|
||||
return exec_(code, *args)
|
||||
|
||||
|
||||
del builtins
|
||||
@ -382,7 +386,9 @@ else:
|
||||
|
||||
def execfile_(fname, *args):
|
||||
""" Overriding PY2 execfile() implementation to support .pyc files """
|
||||
return exec_(_get_codeobj(fname), *args)
|
||||
if fname.endswith(".pyc"):
|
||||
return exec_(_get_codeobj(fname), *args)
|
||||
return execfile(fname, *args)
|
||||
|
||||
|
||||
def print_(*args, **kwargs):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user