From 1dcf56baf2d98ae0f4ec053be2ee1d4cf222f2b8 Mon Sep 17 00:00:00 2001 From: Rudy Sicard Date: Tue, 5 May 2020 08:31:22 +0000 Subject: [PATCH] Fix #204 triple quote detection incorrect on non stipped line triple quote """ or ''' ending a multiline string are not checked correctly if line ends with comments or spacing or anything --- toml/decoder.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/toml/decoder.py b/toml/decoder.py index a24c04a..739f9a4 100644 --- a/toml/decoder.py +++ b/toml/decoder.py @@ -370,8 +370,9 @@ def loads(s, _dict=dict, decoder=None): decoder.embed_comments(idx, currentlevel) + stripped_line = line.strip() if not multilinestr or multibackslash or '\n' not in multilinestr: - line = line.strip() + line = stripped_line if line == "" and (not multikey or multibackslash): continue if multikey: @@ -379,6 +380,7 @@ def loads(s, _dict=dict, decoder=None): multilinestr += line else: multilinestr += line + line = stripped_line multibackslash = False closed = False if multilinestr[0] == '[':