mirror of
https://github.com/python/cpython.git
synced 2025-09-30 12:21:51 +00:00
bpo-32682: Improve libz version parsing in test_zilb (GH-5347)
(cherry picked from commit 4c7108a771
)
Co-authored-by: pmp-p <pmp-p@users.noreply.github.com>
This commit is contained in:
parent
2a93fae8b5
commit
b0fd935360
1 changed files with 9 additions and 4 deletions
|
@ -751,10 +751,15 @@ class CompressObjectTestCase(BaseCompressTestCase, unittest.TestCase):
|
||||||
def test_wbits(self):
|
def test_wbits(self):
|
||||||
# wbits=0 only supported since zlib v1.2.3.5
|
# wbits=0 only supported since zlib v1.2.3.5
|
||||||
# Register "1.2.3" as "1.2.3.0"
|
# Register "1.2.3" as "1.2.3.0"
|
||||||
v = (zlib.ZLIB_RUNTIME_VERSION + ".0").split(".", 4)
|
# or "1.2.0-linux","1.2.0.f","1.2.0.f-linux"
|
||||||
supports_wbits_0 = int(v[0]) > 1 or int(v[0]) == 1 \
|
v = zlib.ZLIB_RUNTIME_VERSION.split('-', 1)[0].split('.')
|
||||||
and (int(v[1]) > 2 or int(v[1]) == 2
|
if len(v) < 4:
|
||||||
and (int(v[2]) > 3 or int(v[2]) == 3 and int(v[3]) >= 5))
|
v.append('0')
|
||||||
|
elif not v[-1].isnumeric():
|
||||||
|
v[-1] = '0'
|
||||||
|
|
||||||
|
v = tuple(map(int, v))
|
||||||
|
supports_wbits_0 = v >= (1, 2, 3, 5)
|
||||||
|
|
||||||
co = zlib.compressobj(level=1, wbits=15)
|
co = zlib.compressobj(level=1, wbits=15)
|
||||||
zlib15 = co.compress(HAMLET_SCENE) + co.flush()
|
zlib15 = co.compress(HAMLET_SCENE) + co.flush()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue