Skip to content

Commit

Permalink
Fix encoding of r'\x' in strings
Browse files Browse the repository at this point in the history
Fixes github bug uiri#404
  • Loading branch information
jeremysanders committed Sep 5, 2022
1 parent 59d83d0 commit e7bcc0b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion toml/encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ def _dump_str(v):
if singlequote:
v = v.replace("\\'", "'")
v = v.replace('"', '\\"')
v = v.split("\\x")
# split on \x, but not \\x
v = re.split(r"(?<!\\)\\x", v)
while len(v) > 1:
i = -1
if not v[0]:
Expand Down

0 comments on commit e7bcc0b

Please sign in to comment.