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

#27056: pickle: constant propagation in _Unpickler_Read()

Can't Edit
Can't Publish+Mail
Start Review
Created:
1 year, 6 months ago by victor.stinner
Modified:
1 year, 6 months ago
Reviewers:
storchaka
CC:
haypo, devnull_psf.upfronthosting.co.za, storchaka
Visibility:
Public.

Patch Set 1 #

Total comments: 4

Patch Set 2 #

Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Modules/_pickle.c View 1 3 chunks +26 lines, -19 lines 0 comments Download

Messages

Total messages: 2
storchaka_gmail.com
http://bugs.python.org/review/27056/diff/17276/Modules/_pickle.c File Modules/_pickle.c (right): http://bugs.python.org/review/27056/diff/17276/Modules/_pickle.c#newcode1225 Modules/_pickle.c:1225: if (self->next_read_idx + n <= self->input_len) { This case ...
1 year, 6 months ago #1
haypo
1 year, 6 months ago #2
http://bugs.python.org/review/27056/diff/17276/Modules/_pickle.c
File Modules/_pickle.c (right):

http://bugs.python.org/review/27056/diff/17276/Modules/_pickle.c#newcode1225
Modules/_pickle.c:1225: if (self->next_read_idx + n <= self->input_len) {
On 2016/05/19 15:16:24, storchaka wrote:
> This case can be removed now.

Done: replaced with a macro and a comment explaining that _Unpickler_ReadImpl()
must not be called directly.

http://bugs.python.org/review/27056/diff/17276/Modules/_pickle.c#newcode1247
Modules/_pickle.c:1247: ((self->next_read_idx <= PY_SSIZE_T_MAX - (n)          \
On 2016/05/19 15:16:24, storchaka wrote:
> I think these two lines can be replaced with one comparison:
> 
>     (n) <= self->input_len - self->next_read_idx

In fact, I don't think that the fast-path can hit the integer overflow if
"self->next_read_idx + n <= self->input_len". I simplified the macro.
Sign in to reply to this message.

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