There was an error while loading. Please reload this page.
1 parent 30c0bfc commit cf9c6b6Copy full SHA for cf9c6b6
1 file changed
extra_tests/snippets/stdlib_json.py
@@ -239,3 +239,19 @@ class Dict(dict):
239
RecursionError,
240
lambda: json.loads(('[{"x":' * _deep) + "1" + ("}]" * _deep)),
241
)
242
+
243
244
+# Invalid \uXXXX escape: error position points at the 'u', matching CPython.
245
+try:
246
+ json.loads('"\\uXYZW"')
247
+except json.JSONDecodeError as e:
248
+ assert e.pos == 2, f"expected pos=2, got {e.pos}"
249
+else:
250
+ assert False, "expected JSONDecodeError"
251
252
253
+ json.loads('"abc\\uZZZZ"')
254
255
+ assert e.pos == 5, f"expected pos=5, got {e.pos}"
256
257
0 commit comments