aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Lib/json/decoder.py
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.com>2024-12-23 19:39:02 +0300
committershadchin <shadchin@yandex-team.com>2024-12-23 19:54:20 +0300
commit65a5bf9d37a3b29eb394f560b9a09318196c40e8 (patch)
treee5cd68fb0682b2388e52d9806bb87adc348e21a8 /contrib/tools/python3/Lib/json/decoder.py
parenta1dd87a52878ab3e46e5fd2dba5ecbba6113d7e0 (diff)
downloadydb-65a5bf9d37a3b29eb394f560b9a09318196c40e8.tar.gz
Update Python 3 to 3.12.8
commit_hash:c20045b8a987d8720e1f3328270357491d5530f3
Diffstat (limited to 'contrib/tools/python3/Lib/json/decoder.py')
-rw-r--r--contrib/tools/python3/Lib/json/decoder.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/contrib/tools/python3/Lib/json/decoder.py b/contrib/tools/python3/Lib/json/decoder.py
index c5d9ae2d0d..5e5effeac0 100644
--- a/contrib/tools/python3/Lib/json/decoder.py
+++ b/contrib/tools/python3/Lib/json/decoder.py
@@ -50,17 +50,18 @@ _CONSTANTS = {
}
+HEXDIGITS = re.compile(r'[0-9A-Fa-f]{4}', FLAGS)
STRINGCHUNK = re.compile(r'(.*?)(["\\\x00-\x1f])', FLAGS)
BACKSLASH = {
'"': '"', '\\': '\\', '/': '/',
'b': '\b', 'f': '\f', 'n': '\n', 'r': '\r', 't': '\t',
}
-def _decode_uXXXX(s, pos):
- esc = s[pos + 1:pos + 5]
- if len(esc) == 4 and esc[1] not in 'xX':
+def _decode_uXXXX(s, pos, _m=HEXDIGITS.match):
+ esc = _m(s, pos + 1)
+ if esc is not None:
try:
- return int(esc, 16)
+ return int(esc.group(), 16)
except ValueError:
pass
msg = "Invalid \\uXXXX escape"