summaryrefslogtreecommitdiffstats
path: root/yt/python
diff options
context:
space:
mode:
authorrobot-piglet <[email protected]>2025-01-29 11:37:24 +0300
committerrobot-piglet <[email protected]>2025-01-29 11:56:22 +0300
commitb64b540d92479ce07ebf31d35c4fb9cc30516280 (patch)
tree9de0cec22cb07288cc90c353943ae104a01bcbf6 /yt/python
parenta181c4d165ffb7eff61707f209b917e52c7b350b (diff)
Intermediate changes
commit_hash:44e54bd1d02387e22caa89aeb0fcb12985e44622
Diffstat (limited to 'yt/python')
-rw-r--r--yt/python/yt/yson/lexer.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/yt/python/yt/yson/lexer.py b/yt/python/yt/yson/lexer.py
index a6b70cd41e2..e38bdf71974 100644
--- a/yt/python/yt/yson/lexer.py
+++ b/yt/python/yt/yson/lexer.py
@@ -255,14 +255,20 @@ class YsonLexer(object):
raise_yson_error(
"Premature end-of-stream while reading string literal in Yson",
self.get_position_info())
- if ch == b'"' and not pending_next_char:
- break
- if self._output_buffer is None:
- result.append(ch)
+
if pending_next_char:
pending_next_char = False
- elif ch == b"\\":
- pending_next_char = True
+ if ch not in b"abfnrtvuUx01234567\\":
+ # invalid escape sequence support (pass to "unicode_escape")
+ result.pop()
+ else:
+ if ch == b'"':
+ break
+ if ch == b"\\":
+ pending_next_char = True
+
+ if self._output_buffer is None:
+ result.append(ch)
if self._output_buffer is None:
return self._decode_string(self._unescape(b"".join(result)))