1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

loaders: ensure loader stream closed in load_yaml_config()

This commit is contained in:
Ilya Kreymer 2016-03-31 12:41:48 -07:00
parent 8e51ddc544
commit b5cf79072d

View File

@ -37,8 +37,15 @@ def to_file_url(filename):
#=================================================================
def load_yaml_config(config_file):
import yaml
configdata = BlockLoader().load(config_file)
config = yaml.load(configdata)
config = None
configdata = None
try:
configdata = BlockLoader().load(config_file)
config = yaml.load(configdata)
finally:
if configdata:
configdata.close()
return config