Replace yaml.dump with yaml.safe_dump

yaml.dump may fails with unicode error. Though we've not noticed
these issues, it's better to use safe_dump to avoid them.

Change-Id: I024ee0a0176e03d999bef99c76a66d00c204b1af
This commit is contained in:
Feng Shengqin 2017-03-17 14:17:55 +08:00 committed by feng.shengqin
parent 1a49887ca4
commit 08ca2d9c19

View File

@ -13,12 +13,6 @@
import yaml
if hasattr(yaml, 'CSafeDumper'):
yaml_dumper = yaml.CSafeDumper
else:
yaml_dumper = yaml.SafeDumper
def load(s):
try:
yml_dict = yaml.safe_load(s)
@ -36,4 +30,4 @@ def load(s):
def dump(s):
return yaml.dump(s, Dumper=yaml_dumper)
return yaml.safe_dump(s)