Fix #98 - Parse empty inline tables
This commit is contained in:
parent
3521cccf3f
commit
1921458b46
7
toml.py
7
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 \
|
||||
|
|
Loading…
Reference in New Issue