From d97e7e5ab5e7d5ae3b5017bdd3076dfb9e2ff7e4 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: May 22 2020 01:27:35 +0000 Subject: Backport fix for Python 3.8 (RH#1837261) --- diff --git a/0001-wrap-SocketIO-in-io.Buffered-for-makefile.patch b/0001-wrap-SocketIO-in-io.Buffered-for-makefile.patch new file mode 100644 index 0000000..61fa914 --- /dev/null +++ b/0001-wrap-SocketIO-in-io.Buffered-for-makefile.patch @@ -0,0 +1,47 @@ +From d3a43ffe1bfe4c128d6ab7c390419dee68f4ca5a Mon Sep 17 00:00:00 2001 +From: lethliel +Date: Wed, 19 Feb 2020 11:53:05 +0100 +Subject: [PATCH] wrap SocketIO in io.Buffered* for makefile + +In python3.8 the fp is wrapped in a Buffer. +SSL.Connection.makefile returns a socketIO which is no buffer. + +SocketIO in 'r' mode: +use io.BufferedReader + +SocketIO in 'rw' mode: +use io.BufferedRWPair +--- + M2Crypto/SSL/Connection.py | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/M2Crypto/SSL/Connection.py b/M2Crypto/SSL/Connection.py +index 7053aa6..01bb61c 100644 +--- a/M2Crypto/SSL/Connection.py ++++ b/M2Crypto/SSL/Connection.py +@@ -12,6 +12,7 @@ Copyright 2008 Heikki Toivonen. All rights reserved. + + import logging + import socket ++import io + + from M2Crypto import BIO, Err, X509, m2, py27plus, six, util # noqa + from M2Crypto.SSL import Checker, Context, timeout # noqa +@@ -582,9 +583,12 @@ class Connection(object): + return m2.ssl_set_cipher_list(self.ssl, cipher_list) + + def makefile(self, mode='rb', bufsize=-1): +- # type: (AnyStr, int) -> socket._fileobject ++ # type: (AnyStr, int) -> Union[io.BufferedRWPair,io.BufferedReader] + if six.PY3: +- return socket.SocketIO(self, mode) ++ raw = socket.SocketIO(self, mode) ++ if 'rw' in mode: ++ return io.BufferedRWPair(raw, raw) ++ return io.BufferedReader(raw, io.DEFAULT_BUFFER_SIZE) + else: + return socket._fileobject(self, mode, bufsize) + +-- +2.26.1 + diff --git a/m2crypto.spec b/m2crypto.spec index ab1f252..44a6bc6 100644 --- a/m2crypto.spec +++ b/m2crypto.spec @@ -3,13 +3,17 @@ Name: m2crypto Version: 0.35.2 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Support for using OpenSSL in Python scripts License: MIT URL: https://gitlab.com/m2crypto/m2crypto/ Source0: %{pypi_source M2Crypto} +# Backport from upstream +## From: https://gitlab.com/m2crypto/m2crypto/-/commit/d3a43ffe1bfe4c128d6ab7c390419dee68f4ca5a +Patch0001: 0001-wrap-SocketIO-in-io.Buffered-for-makefile.patch + BuildRequires: gcc BuildRequires: openssl BuildRequires: openssl-devel @@ -61,6 +65,9 @@ fi %{python3_sitearch}/M2Crypto-*.egg-info/ %changelog +* Thu May 21 2020 Neal Gompa - 0.35.2-7 +- Backport fix for Python 3.8 (RH#1837261) + * Wed Jan 29 2020 Fedora Release Engineering - 0.35.2-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild