Merge pull request #6377 from sivel/issue/6348

Don't lstrip data to be parsed by parse_yaml. Fixes #6384
This commit is contained in:
Michael DeHaan 2014-03-10 13:51:14 -05:00
commit d9c22cd997

View file

@ -354,9 +354,9 @@ def smush_ds(data):
def parse_yaml(data, path_hint=None):
''' convert a yaml string to a data structure. Also supports JSON, ssssssh!!!'''
data = data.lstrip()
stripped_data = data.lstrip()
loaded = None
if data.startswith("{") or data.startswith("["):
if stripped_data.startswith("{") or stripped_data.startswith("["):
# since the line starts with { or [ we can infer this is a JSON document.
try:
loaded = json.loads(data)