Skip to content

Commit

Permalink
00419: pythongh-112769: test_zlib: Fix comparison of ZLIB_RUNTIME_VER…
Browse files Browse the repository at this point in the history
…SION with non-int suffix (pythonGH-112771) (pythonGH-112774)

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)
  • Loading branch information
hroncok authored and hrnciar committed Sep 9, 2024
1 parent 128192c commit a6ddf46
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Lib/test/test_zlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ def _zlib_runtime_version_tuple(zlib_version=zlib.ZLIB_RUNTIME_VERSION):
ZLIB_RUNTIME_VERSION_TUPLE = _zlib_runtime_version_tuple()


def _zlib_runtime_version_tuple(zlib_version=zlib.ZLIB_RUNTIME_VERSION):
# Register "1.2.3" as "1.2.3.0"
# or "1.2.0-linux","1.2.0.f","1.2.0.f-linux"
v = zlib_version.split('-', 1)[0].split('.')
if len(v) < 4:
v.append('0')
elif not v[-1].isnumeric():
v[-1] = '0'
return tuple(map(int, v))


ZLIB_RUNTIME_VERSION_TUPLE = _zlib_runtime_version_tuple()


class VersionTestCase(unittest.TestCase):

def test_library_version(self):
Expand Down

0 comments on commit a6ddf46

Please sign in to comment.