Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/tomli/_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,8 @@ def parse_basic_str_escape(
pos += 1
pos = skip_chars(src, pos, TOML_WS_AND_NEWLINE)
return pos, ""
if escape_id == "\\x":
return parse_hex_char(src, pos, 2)
if escape_id == "\\u":
return parse_hex_char(src, pos, 4)
if escape_id == "\\U":
Expand Down
8 changes: 6 additions & 2 deletions tests/data/valid/multiline-basic-str/replacements.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
{"escape":
{"type":"string","value":"\u001B"}}
{
"escape": {"type":"string","value":"\u001B"},
"tab": {"type":"string","value":"\t"},
"upper-j": {"type":"string","value":"J"},
"upper-j-2": {"type":"string","value":"J"}
}
5 changes: 4 additions & 1 deletion tests/data/valid/multiline-basic-str/replacements.toml
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
escape = "\e"
escape = "\e"
tab = "\x09"
upper-j = "\x4a"
upper-j-2 = "\x4A"
2 changes: 0 additions & 2 deletions tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,9 @@ def test_valid(self):
# compatible with yet.
if valid.stem in {
"no-seconds",
"hex-escape",
"common-34",
"common-31",
"common-29",
"common-12",
}:
with self.assertRaises(tomllib.TOMLDecodeError):
tomllib.loads(toml_str)
Expand Down