Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(6)

#17906: JSON should accept lone surrogates

Can't Edit
Can't Publish+Mail
Start Review
Created:
6 years, 9 months ago by storchaka+cpython
Modified:
6 years, 9 months ago
Reviewers:
ezio.melotti
CC:
rhettinger, Bob Ippolito, AntoinePitrou, ezio.melotti, storchaka
Visibility:
Public.

Patch Set 1 #

Total comments: 2

Patch Set 2 #

Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Lib/json/decoder.py View 1 1 chunk +10 lines, -11 lines 0 comments Download
Lib/json/tests/test_scanstring.py View 1 2 chunks +44 lines, -4 lines 0 comments Download
Modules/_json.c View 1 4 chunks +13 lines, -36 lines 0 comments Download

Messages

Total messages: 1
ezio.melotti
6 years, 9 months ago #1
http://bugs.python.org/review/17906/diff/8068/Lib/json/decoder.py
File Lib/json/decoder.py (right):

http://bugs.python.org/review/17906/diff/8068/Lib/json/decoder.py#newcode122
Lib/json/decoder.py:122: uni2 = int(esc2, 16)
Doesn't this raise an exception if esc2 is a non-hex 4-chars sequence?  Is the
exception handled somewhere else?  Does it raise the same error message of the C
version?
(also note that there's the same code above)

http://bugs.python.org/review/17906/diff/8068/Lib/test/json_tests/test_scanst...
File Lib/test/json_tests/test_scanstring.py (right):

http://bugs.python.org/review/17906/diff/8068/Lib/test/json_tests/test_scanst...
Lib/test/json_tests/test_scanstring.py:130: scanstring('"z\\ud83x"', 1, True)
I would also add tests for '"\\ud8"' and '"\\u"' to make sure it doesn't try to
read past the end.  Adding tests for high-high, low-low, and low-high might be
good too.
Sign in to reply to this message.

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+