bpo-32682: test_zlib improve version parsing#5347
bpo-32682: test_zlib improve version parsing#5347zware merged 8 commits intopython:masterfrom pmp-p:patch-3
Conversation
|
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. Thanks again to your contribution and we look forward to looking at it! |
Lib/test/test_zlib.py
Outdated
| # wbits=0 only supported since zlib v1.2.3.5 | ||
| # Register "1.2.3" as "1.2.3.0" | ||
| v = (zlib.ZLIB_RUNTIME_VERSION + ".0").split(".", 4) | ||
| if zlib.ZLIB_RUNTIME_VERSION.find('-')>=0: |
There was a problem hiding this comment.
"-" in zlib.ZLIB_RUNTIME_VERSION would be simpler
Lib/test/test_zlib.py
Outdated
| v = list(map( int , zlib.ZLIB_RUNTIME_VERSION.split('-',1)[0].split('.')[:3] )) | ||
| v.append(0) | ||
| else: | ||
| v = (zlib.ZLIB_RUNTIME_VERSION + ".0").split(".", 4) |
There was a problem hiding this comment.
You should factorize the code between the if/else block. Something like:
v = zlib.ZLIB_RUNTIME_VERSION
if "-" in v:
v = v.split('-',1)[0]
v = (v + ".0").split(".", 4)
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
|
or this way ? ( sorry learning interface :p ) |
pmp-p
left a comment
There was a problem hiding this comment.
maybe a line too long
|
I have made the requested changes; please review again |
|
Thanks for making the requested changes! @vstinner: please review the changes made to this pull request. |
zware
left a comment
There was a problem hiding this comment.
Just a couple of minor fixes needed.
Lib/test/test_zlib.py
Outdated
| supports_wbits_0 = ( v[0] > 1 ) or ( v[0] == 1 ) \ | ||
| and ( v[1] > 2 ) or ( v[1] == 2 ) \ | ||
| and ( v[2] > 3 ) or ( v[2] == 3 ) \ | ||
| and ( v[3] >= 5 ) |
There was a problem hiding this comment.
Why not supports_wbits_0 = v >= (1, 2, 3, 5)?
Lib/test/test_zlib.py
Outdated
| elif not v[-1].isnumeric(): | ||
| v[-1] = '0' | ||
|
|
||
| v = tuple( map( int, v ) ) |
There was a problem hiding this comment.
No need for the extra spaces around ( or ); v = tuple(map(int, v)). (See PEP 8.)
Lib/test/test_zlib.py
Outdated
| and ( v[1] > 2 ) or ( v[1] == 2 ) \ | ||
| and ( v[2] > 3 ) or ( v[2] == 3 ) \ | ||
| and ( v[3] >= 5 ) | ||
| del v |
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
|
I have made the requested changes; please review again |
(cherry picked from commit 4c7108a) Co-authored-by: pmp-p <[email protected]>
|
GH-5751 is a backport of this pull request to the 3.7 branch. |
|
Sorry, @pmp-p and @zware, I could not cleanly backport this to |
(cherry picked from commit 4c7108a) Co-authored-by: pmp-p <[email protected]>
|
GH-5752 is a backport of this pull request to the 3.6 branch. |
|
@serhiy-storchaka This doesn't appear to need to go back to 2.7; would you mind taking care of that one way or the other? I would vote for the simple solution of just removing the label :) |
(cherry picked from commit 4c7108a) Co-authored-by: pmp-p <[email protected]>
(cherry picked from commit 4c7108a) Co-authored-by: pmp-p <[email protected]>
fix odd version number parsing of zlib found at least on some android versions.
https://bugs.python.org/issue32682
https://bugs.python.org/issue32682