Fix test_zlib with zlib-ng-compat
This commit is contained in:
parent
53abe334d1
commit
d1898e800c
2 changed files with 76 additions and 1 deletions
|
|
@ -0,0 +1,66 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
|
||||
Date: Tue, 5 Dec 2023 21:02:06 +0100
|
||||
Subject: [PATCH] 00419: gh-112769: test_zlib: Fix comparison of
|
||||
ZLIB_RUNTIME_VERSION with non-int suffix (GH-112771) (GH-112774)
|
||||
|
||||
zlib-ng defines the version as "1.3.0.zlib-ng".
|
||||
(cherry picked from commit d384813ff18b33280a90b6d2011654528a2b6ad1)
|
||||
---
|
||||
Lib/test/test_zlib.py | 28 ++++++++++++++++------------
|
||||
1 file changed, 16 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py
|
||||
index 02509cdf55..2a9e7e5ed3 100644
|
||||
--- a/Lib/test/test_zlib.py
|
||||
+++ b/Lib/test/test_zlib.py
|
||||
@@ -17,6 +17,20 @@ requires_Decompress_copy = unittest.skipUnless(
|
||||
'requires Decompress.copy()')
|
||||
|
||||
|
||||
+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):
|
||||
@@ -437,9 +451,8 @@ class CompressObjectTestCase(BaseCompressTestCase, unittest.TestCase):
|
||||
sync_opt = ['Z_NO_FLUSH', 'Z_SYNC_FLUSH', 'Z_FULL_FLUSH',
|
||||
'Z_PARTIAL_FLUSH']
|
||||
|
||||
- ver = tuple(int(v) for v in zlib.ZLIB_RUNTIME_VERSION.split('.'))
|
||||
# Z_BLOCK has a known failure prior to 1.2.5.3
|
||||
- if ver >= (1, 2, 5, 3):
|
||||
+ if ZLIB_RUNTIME_VERSION_TUPLE >= (1, 2, 5, 3):
|
||||
sync_opt.append('Z_BLOCK')
|
||||
|
||||
sync_opt = [getattr(zlib, opt) for opt in sync_opt
|
||||
@@ -768,16 +781,7 @@ class CompressObjectTestCase(BaseCompressTestCase, unittest.TestCase):
|
||||
|
||||
def test_wbits(self):
|
||||
# wbits=0 only supported since zlib v1.2.3.5
|
||||
- # 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.ZLIB_RUNTIME_VERSION.split('-', 1)[0].split('.')
|
||||
- if len(v) < 4:
|
||||
- v.append('0')
|
||||
- elif not v[-1].isnumeric():
|
||||
- v[-1] = '0'
|
||||
-
|
||||
- v = tuple(map(int, v))
|
||||
- supports_wbits_0 = v >= (1, 2, 3, 5)
|
||||
+ supports_wbits_0 = ZLIB_RUNTIME_VERSION_TUPLE >= (1, 2, 3, 5)
|
||||
|
||||
co = zlib.compressobj(level=1, wbits=15)
|
||||
zlib15 = co.compress(HAMLET_SCENE) + co.flush()
|
||||
|
|
@ -17,7 +17,7 @@ URL: https://www.python.org/
|
|||
#global prerel ...
|
||||
%global upstream_version %{general_version}%{?prerel}
|
||||
Version: %{general_version}%{?prerel:~%{prerel}}
|
||||
Release: 5%{?dist}
|
||||
Release: 6%{?dist}
|
||||
License: Python
|
||||
|
||||
|
||||
|
|
@ -392,6 +392,12 @@ Patch407: 00407-gh-99086-fix-implicit-int-compiler-warning-in-configure-check-fo
|
|||
# Thomas Dwyer.
|
||||
Patch415: 00415-cve-2023-27043-gh-102988-reject-malformed-addresses-in-email-parseaddr-111116.patch
|
||||
|
||||
# 00419 # f13682530cc7e4daec2e40acd56508846fdd3aad
|
||||
# gh-112769: test_zlib: Fix comparison of ZLIB_RUNTIME_VERSION with non-int suffix (GH-112771) (GH-112774)
|
||||
#
|
||||
# zlib-ng defines the version as "1.3.0.zlib-ng".
|
||||
Patch419: 00419-gh-112769-test_zlib-fix-comparison-of-zlib_runtime_version-with-non-int-suffix-gh-112771-gh-112774.patch
|
||||
|
||||
# (New patches go here ^^^)
|
||||
#
|
||||
# When adding new patches to "python" and "python3" in Fedora, EL, etc.,
|
||||
|
|
@ -1818,6 +1824,9 @@ CheckPython optimized
|
|||
# ======================================================
|
||||
|
||||
%changelog
|
||||
* Mon Jan 29 2024 Karolina Surma <ksurma@redhat.com> - 3.9.18-6
|
||||
- Fix test_zlib when building with zlib-ng-compat
|
||||
|
||||
* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.9.18-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue