Skip to content

Commit 6c95cfb

Browse files
committed
Fix missing array close bracket
1 parent 76e5b82 commit 6c95cfb

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

tests/test_api.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
from toml.decoder import InlineTableDict
99

10-
1110
TEST_STR = """
1211
[a]\r
1312
b = 1\r
@@ -44,6 +43,12 @@ def test_bug_196():
4443
assert round_trip_bug_dict['x'] == bug_dict['x']
4544

4645

46+
def test_bug_207():
47+
with pytest.raises(toml.TomlDecodeError):
48+
toml.loads('arr7=['
49+
'"red", "yellow", "green"')
50+
51+
4752
def test_valid_tests():
4853
valid_dir = "toml-test/tests/valid/"
4954
for f in os.listdir(valid_dir):

toml/decoder.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ def _getpath(p):
4343
except NameError:
4444
FNFError = IOError
4545

46-
4746
TIME_RE = re.compile(r"([0-9]{2}):([0-9]{2}):([0-9]{2})(\.([0-9]{3,6}))?")
4847

4948

@@ -805,7 +804,7 @@ def load_value(self, v, strictly_valid=True):
805804
v[1] == v[2]):
806805
v = v[2:-2]
807806
return (v[1:-1], "str")
808-
elif v[0] == '[':
807+
elif v[0] == '[' and v[len(v) - 1] == ']':
809808
return (self.load_array(v), "array")
810809
elif v[0] == '{':
811810
inline_object = self.get_empty_inline_table()

0 commit comments

Comments
 (0)