diff --git a/toml.py b/toml.py index 49632ed..e7d2f6b 100644 --- a/toml.py +++ b/toml.py @@ -335,9 +335,14 @@ def loads(s, _dict=dict): def _load_inline_object(line, currentlevel, _dict, multikey=False, multibackslash=False): candidate_groups = line[1:-1].split(",") groups = [] + if len(candidate_groups) == 1 and not candidate_groups[0].strip(): + candidate_groups.pop() while len(candidate_groups) > 0: candidate_group = candidate_groups.pop(0) - _, value = candidate_group.split('=', 1) + try: + _, value = candidate_group.split('=', 1) + except ValueError: + raise TomlDecodeError("Invalid inline table encountered") value = value.strip() if (value[0] == value[-1] and value[0] in ('"', "'")) or \ value[0] in '-0123456789' or \