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

#25626: Gzip fails for file over 2**32 bytes

Can't Edit
Can't Publish+Mail
Start Review
Created:
4 years, 2 months ago by ben.cipollini
Modified:
4 years, 1 month ago
Reviewers:
storchaka, vadmium+py
CC:
Thomas Wouters, nadeem.vawda, devnull_psf.upfronthosting.co.za, Martin Panter, storchaka, matthew.brett_gmail.com, ben.cipollini_gmail.com
Visibility:
Public.

Patch Set 1 #

Total comments: 2

Patch Set 2 #

Patch Set 3 #

Total comments: 13

Patch Set 4 #

Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Doc/howto/clinic.rst View 1 2 3 1 chunk +8 lines, -8 lines 0 comments Download
Lib/test/support/__init__.py View 1 2 3 1 chunk +8 lines, -5 lines 0 comments Download
Lib/test/test_gzip.py View 1 2 3 2 chunks +9 lines, -0 lines 0 comments Download
Lib/test/test_zlib.py View 1 2 3 5 chunks +55 lines, -1 line 0 comments Download
Misc/NEWS View 1 2 3 1 chunk +7 lines, -0 lines 0 comments Download
Modules/clinic/zlibmodule.c.h View 1 2 3 4 chunks +4 lines, -4 lines 0 comments Download
Modules/zlibmodule.c View 1 2 3 7 chunks +29 lines, -29 lines 0 comments Download

Messages

Total messages: 5
storchaka_gmail.com
http://bugs.python.org/review/25626/diff/15966/Lib/test/test_zlib.py File Lib/test/test_zlib.py (right): http://bugs.python.org/review/25626/diff/15966/Lib/test/test_zlib.py#newcode371 Lib/test/test_zlib.py:371: self.assertEqual(dco.decompress(b'', sys.maxsize), b'') Empty data can be a special ...
4 years, 2 months ago #1
Martin Panter
https://bugs.python.org/review/25626/diff/15966/Lib/test/test_zlib.py File Lib/test/test_zlib.py (right): https://bugs.python.org/review/25626/diff/15966/Lib/test/test_zlib.py#newcode371 Lib/test/test_zlib.py:371: self.assertEqual(dco.decompress(b'', sys.maxsize), b'') On 2015/11/19 09:15:22, storchaka wrote: > ...
4 years, 1 month ago #2
storchaka_gmail.com
http://bugs.python.org/review/25626/diff/15995/Lib/test/support/__init__.py File Lib/test/support/__init__.py (right): http://bugs.python.org/review/25626/diff/15995/Lib/test/support/__init__.py#newcode1611 Lib/test/support/__init__.py:1611: 'size' is a requested size for the test (in ...
4 years, 1 month ago #3
Martin Panter
https://bugs.python.org/review/25626/diff/15995/Lib/test/support/__init__.py File Lib/test/support/__init__.py (right): https://bugs.python.org/review/25626/diff/15995/Lib/test/support/__init__.py#newcode1612 Lib/test/support/__init__.py:1612: units.) 'memuse' is the number of bytes per 'size' ...
4 years, 1 month ago #4
storchaka_gmail.com
4 years, 1 month ago #5
The patch LGTM.

https://bugs.python.org/review/25626/diff/15995/Modules/zlibmodule.c
File Modules/zlibmodule.c (right):

https://bugs.python.org/review/25626/diff/15995/Modules/zlibmodule.c#newcode240
Modules/zlibmodule.c:240: Py_ssize_t val = PyLong_AsSsize_t(obj);
On 2015/11/21 01:36:20, vadmium wrote:
> It actually calls __int__().

Yes, you are right.

> To keep the changes to a minimum I propose to use _PyLong_FromNbInt() to call
> __int__().

Agree. It is more compatible.

https://bugs.python.org/review/25626/diff/15995/Modules/zlibmodule.c#newcode250
Modules/zlibmodule.c:250: if ((size_t)val > UINT_MAX) {
On 2015/11/21 01:36:20, vadmium wrote:
> On 2015/11/20 15:22:39, storchaka wrote:
> >     if ((size_t)val > UINT_MAX)
> >         val = UINT_MAX;
> 
> This doesn’t feel right. On a 32-bit system, the whole “if” block could be
> optimized out, but if not, we are assigning an out-of-range value.
> 
> But I am a bit rusty with C coding, so if you still think it is better I am
> happy to change it.

Your are right.
Sign in to reply to this message.

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