Skip to content

Commit

Permalink
Fix #113: Bug with string inside multiline string
Browse files Browse the repository at this point in the history
  • Loading branch information
uiri committed Mar 25, 2018
1 parent 1a50a5f commit 65f997f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions toml/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,12 +603,18 @@ def load_value(self, v, strictly_valid=True):
return (False, "bool")
elif v[0] == '"':
testv = v[1:].split('"')
triplequote = False
triplequotecount = 0
if testv[0] == '' and testv[1] == '':
testv = testv[2:-2]
testv = testv[2:]
triplequote = True
closed = False
for tv in testv:
if tv == '':
closed = True
if triplequote:
triplequotecount += 1
if not triplequote:
closed = True
else:
oddbackslash = False
try:
Expand All @@ -624,7 +630,10 @@ def load_value(self, v, strictly_valid=True):
if closed:
raise ValueError("Stuff after closed string. WTF?")
else:
closed = True
if not triplequote or triplequotecount > 1:
closed = True
else:
triplequotecount = 0
escapeseqs = v.split('\\')[1:]
backslash = False
for i in escapeseqs:
Expand Down

0 comments on commit 65f997f

Please sign in to comment.