Skip to content

Commit

Permalink
show meaningful error message for wrong case booleans (uiri#315)
Browse files Browse the repository at this point in the history
  • Loading branch information
abred authored Oct 27, 2020
1 parent 16a6441 commit 38a9685
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions toml/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,8 +811,12 @@ def load_value(self, v, strictly_valid=True):
raise ValueError("Empty value is invalid")
if v == 'true':
return (True, "bool")
elif v.lower() == 'true':
raise ValueError("Only all lowercase booleans allowed")
elif v == 'false':
return (False, "bool")
elif v.lower() == 'false':
raise ValueError("Only all lowercase booleans allowed")
elif v[0] == '"' or v[0] == "'":
quotechar = v[0]
testv = v[1:].split(quotechar)
Expand Down

0 comments on commit 38a9685

Please sign in to comment.