Fix test_ssltransport for changes in ssl.SSLSocket in Python 3.11.3

Related: RHEL-59991
This commit is contained in:
Lumir Balhar 2024-10-01 08:47:40 +02:00
parent 687cabc275
commit 22c879c9d5
2 changed files with 42 additions and 1 deletions

View File

@ -0,0 +1,31 @@
From 00c3895e43305e8fd8394ef74d6466f90afcedb6 Mon Sep 17 00:00:00 2001
From: Thomas Grainger <tagrain@gmail.com>
Date: Mon, 24 Apr 2023 19:10:26 +0100
Subject: [PATCH] Fix test_ssl_object_attributes
Co-authored-by: Seth Michael Larson <sethmichaellarson@gmail.com>
---
test/test_ssltransport.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/test/test_ssltransport.py b/test/test_ssltransport.py
index f548e06..fd363a2 100644
--- a/test/test_ssltransport.py
+++ b/test/test_ssltransport.py
@@ -202,8 +202,11 @@ class SingleTLSLayerTestCase(SocketDummyServerTestCase):
assert ssock.selected_npn_protocol() is None
shared_ciphers = ssock.shared_ciphers()
- assert type(shared_ciphers) == list
- assert len(shared_ciphers) > 0
+ # SSLContext.shared_ciphers() changed behavior completely in a patch version.
+ # See: https://github.com/python/cpython/issues/96931
+ assert shared_ciphers is None or (
+ type(shared_ciphers) is list and len(shared_ciphers) > 0
+ )
assert ssock.compression() is None
--
2.46.2

View File

@ -8,7 +8,7 @@
Name: python%{python3_pkgversion}-%{srcname}
Version: 1.26.12
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Python HTTP library with thread-safe connection pooling and file post
License: MIT
@ -32,6 +32,12 @@ Patch1: CVE-2023-43804.patch
# Upstream fix: https://github.com/urllib3/urllib3/commit/40b6d1605814dd1db0a46e202d6e56f2e4c9a468
Patch2: CVE-2024-37891.patch
# The implementation of ssl.SSLSocket.shared_ciphers has been fixed
# in Python 3.11.3 and that requires a fix for the testsuite.
# Upstream fix: https://github.com/urllib3/urllib3/commit/25cca389496b86ee809c21e5b641aeaa74809263
# CPython change: https://github.com/python/cpython/issues/96931
Patch3: fix_test_ssltransport_py311.patch
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-rpm-macros
BuildRequires: python%{python3_pkgversion}-setuptools
@ -126,6 +132,10 @@ ln -s %{python3_sitelib}/__pycache__/six.cpython-%{python3_version_nodots}.pyc \
%changelog
* Tue Oct 01 2024 Lumír Balhar <lbalhar@redhat.com> - 1.26.12-4
- Fix test_ssltransport for changes in ssl.SSLSocket in Python 3.11.3
Related: RHEL-59991
* Wed Sep 25 2024 Lumír Balhar <lbalhar@redhat.com> - 1.26.12-3
- Security fix for CVE-2024-37891
Resolves: RHEL-59991