Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotted keys with multiline strings #279

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions toml/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ def loads(s, _dict=dict, decoder=None):
" Reached end of file.", original, len(s))
s = ''.join(sl)
s = s.split('\n')
multilevel = None
multikey = None
multilinestr = ""
multibackslash = False
Expand Down Expand Up @@ -392,7 +393,8 @@ def loads(s, _dict=dict, decoder=None):
value, vtype = decoder.load_value(multilinestr)
except ValueError as err:
raise TomlDecodeError(str(err), original, pos)
currentlevel[multikey] = value
multilevel[multikey] = value
multilevel = None
multikey = None
multilinestr = ""
else:
Expand Down Expand Up @@ -509,7 +511,7 @@ def loads(s, _dict=dict, decoder=None):
except ValueError as err:
raise TomlDecodeError(str(err), original, pos)
if ret is not None:
multikey, multilinestr, multibackslash = ret
multilevel, multikey, multilinestr, multibackslash = ret
return retval


Expand Down Expand Up @@ -779,7 +781,7 @@ def load_line(self, line, currentlevel, multikey, multibackslash):
raise ValueError("Duplicate keys!")
except KeyError:
if multikey:
return multikey, multilinestr, multibackslash
return currentlevel, multikey, multilinestr, multibackslash
else:
currentlevel[pair[0]] = value

Expand Down