mirror of
https://github.com/python/cpython.git
synced 2025-08-17 15:21:26 +00:00
[3.12] gh-125660: Reject invalid unicode escapes for Python implementation of JSON decoder (GH-125683) (GH-125695)
(cherry picked from commit df751363e3
)
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
This commit is contained in:
parent
18196fea89
commit
2746ec4ce2
3 changed files with 16 additions and 4 deletions
|
@ -116,6 +116,11 @@ class TestScanstring:
|
|||
'"\\u012z"',
|
||||
'"\\u0x12"',
|
||||
'"\\u0X12"',
|
||||
'"\\u{0}"'.format("\uff10" * 4),
|
||||
'"\\u 123"',
|
||||
'"\\u-123"',
|
||||
'"\\u+123"',
|
||||
'"\\u1_23"',
|
||||
'"\\ud834\\"',
|
||||
'"\\ud834\\u"',
|
||||
'"\\ud834\\ud"',
|
||||
|
@ -127,6 +132,11 @@ class TestScanstring:
|
|||
'"\\ud834\\udd2z"',
|
||||
'"\\ud834\\u0x20"',
|
||||
'"\\ud834\\u0X20"',
|
||||
'"\\ud834\\u{0}"'.format("\uff10" * 4),
|
||||
'"\\ud834\\u 123"',
|
||||
'"\\ud834\\u-123"',
|
||||
'"\\ud834\\u+123"',
|
||||
'"\\ud834\\u1_23"',
|
||||
]
|
||||
for s in bad_escapes:
|
||||
with self.assertRaises(self.JSONDecodeError, msg=s):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue