Fix #98 - Parse empty inline tables

This commit is contained in:
Uiri 2017-05-08 20:44:52 -04:00
parent 3521cccf3f
commit 1921458b46
1 changed files with 6 additions and 1 deletions

View File

@ -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 \