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

#15379: Charmap decoding of no-BMP characters

Can't Edit
Can't Publish+Mail
Start Review
Created:
7 years, 3 months ago by storchaka+cpython
Modified:
7 years ago
Reviewers:
pitrou
CC:
lemburg, amaury.forgeotdarc, AntoinePitrou, haypo, Benjamin Peterson, ezio.melotti, devnull_psf.upfronthosting.co.za, storchaka
Visibility:
Public.

Patch Set 1 #

Patch Set 2 #

Patch Set 3 #

Total comments: 10

Patch Set 4 #

Patch Set 5 #

Patch Set 6 #

Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Lib/test/test_codeccallbacks.py View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
Lib/test/test_codecs.py View 1 2 3 4 5 2 chunks +105 lines, -0 lines 0 comments Download
Misc/NEWS View 1 2 3 4 5 1 chunk +3 lines, -0 lines 0 comments Download
Objects/unicodeobject.c View 1 2 3 4 5 1 chunk +26 lines, -2 lines 0 comments Download

Messages

Total messages: 4
AntoinePitrou
http://bugs.python.org/review/15379/diff/5446/Lib/test/test_codecs.py File Lib/test/test_codecs.py (right): http://bugs.python.org/review/15379/diff/5446/Lib/test/test_codecs.py#newcode1608 Lib/test/test_codecs.py:1608: def test_decode_with_int2int_map(self): How about adding a test case for ...
7 years, 1 month ago #1
storchaka_gmail.com
http://bugs.python.org/review/15379/diff/5446/Lib/test/test_codecs.py File Lib/test/test_codecs.py (right): http://bugs.python.org/review/15379/diff/5446/Lib/test/test_codecs.py#newcode1608 Lib/test/test_codecs.py:1608: def test_decode_with_int2int_map(self): On 2012/09/17 21:06:19, AntoinePitrou wrote: > How ...
7 years, 1 month ago #2
AntoinePitrou
http://bugs.python.org/review/15379/diff/5446/Objects/unicodeobject.c File Objects/unicodeobject.c (right): http://bugs.python.org/review/15379/diff/5446/Objects/unicodeobject.c#newcode5275 Objects/unicodeobject.c:5275: Py_ssize_t needed = 6 - extrachars; On 2012/09/17 22:41:04, ...
7 years, 1 month ago #3
storchaka_gmail.com
7 years, 1 month ago #4
http://bugs.python.org/review/15379/diff/5446/Objects/unicodeobject.c
File Objects/unicodeobject.c (right):

http://bugs.python.org/review/15379/diff/5446/Objects/unicodeobject.c#newcode...
Objects/unicodeobject.c:5275: Py_ssize_t needed = 6 - extrachars;
On 2012/09/17 22:52:10, AntoinePitrou wrote:
> On 2012/09/17 22:41:04, storchaka wrote:
> > On 2012/09/17 21:06:19, AntoinePitrou wrote:
> > > Can `needed` be negative? The logic isn't very clear.
> > 
> > No, it can not, extrachars is 0 or 1. This is a modified copy of code for
> > int->str mapping (from line 5320 below) with targetsize=2. I deliberately
kept
> > similarity.
> 
> Are you sure? In the code below, extrachars is grown by `targetsize << 2`,
and
> targetsize can be any value, so extrachars could be greater than 6.

Oh, I see my mistake. There must be 10 instead of 6. In the code below,
extrachars is grown by `5 * targetsize - extrachars`. Here `targetsize` is 2
(surrogates pair) and `extrachars` is 0 or 1 (0 <= extrachars < targetsize).
Sign in to reply to this message.

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