forked from orbit-oss/flask
Ensure that config file is closed immediately
This commit is contained in:
parent
a0801719f8
commit
43b6d0a6d0
1 changed files with 2 additions and 1 deletions
|
|
@ -125,7 +125,8 @@ class Config(dict):
|
||||||
d = imp.new_module('config')
|
d = imp.new_module('config')
|
||||||
d.__file__ = filename
|
d.__file__ = filename
|
||||||
try:
|
try:
|
||||||
exec(compile(open(filename).read(), filename, 'exec'), d.__dict__)
|
with open(filename) as config_file:
|
||||||
|
exec(compile(config_file.read(), filename, 'exec'), d.__dict__)
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
if silent and e.errno in (errno.ENOENT, errno.EISDIR):
|
if silent and e.errno in (errno.ENOENT, errno.EISDIR):
|
||||||
return False
|
return False
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue