Skip to content

Commit

Permalink
saumelcolvin's multiline string fix uiri#265
Browse files Browse the repository at this point in the history
  • Loading branch information
eliwaksbaum authored Oct 25, 2021
1 parent 3f637db commit 62628ce
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions toml/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,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 @@ -395,7 +396,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 @@ -513,7 +515,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 @@ -783,7 +785,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

0 comments on commit 62628ce

Please sign in to comment.