mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Fix ResourceWarning when reading a Python config module (#1889)
The raw open call in execfile_() did not close the file handle.
This commit is contained in:
parent
df8290d153
commit
eae3ef05f3
@ -60,7 +60,6 @@ def execfile_(fname, *args):
|
|||||||
if fname.endswith(".pyc"):
|
if fname.endswith(".pyc"):
|
||||||
code = _get_codeobj(fname)
|
code = _get_codeobj(fname)
|
||||||
else:
|
else:
|
||||||
code = compile(open(fname, 'rb').read(), fname, 'exec')
|
with open(fname, 'rb') as file:
|
||||||
|
code = compile(file.read(), fname, 'exec')
|
||||||
return exec(code, *args)
|
return exec(code, *args)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user