diff --git a/871bae572cafc3afb81eb13705945f0a6f708d54.patch b/871bae572cafc3afb81eb13705945f0a6f708d54.patch new file mode 100644 index 0000000..993d11a --- /dev/null +++ b/871bae572cafc3afb81eb13705945f0a6f708d54.patch @@ -0,0 +1,106 @@ +From 871bae572cafc3afb81eb13705945f0a6f708d54 Mon Sep 17 00:00:00 2001 +From: Armin Rigo +Date: Tue, 1 Feb 2022 08:00:11 +0100 +Subject: [PATCH] =?UTF-8?q?apply=20patch=20from=20Tom=C3=A1=C5=A1=20on=20P?= + =?UTF-8?q?R=20111?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--HG-- +branch : adapt-tests-for-python3.11 +--- + c/test_c.py | 47 ++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 46 insertions(+), 1 deletion(-) + +diff --git a/c/test_c.py b/c/test_c.py +index 654584d9..906eb074 100644 +--- a/c/test_c.py ++++ b/c/test_c.py +@@ -1331,9 +1331,11 @@ def test_callback_exception(): + except ImportError: + import io as cStringIO # Python 3 + import linecache +- def matches(istr, ipattern, ipattern38): ++ def matches(istr, ipattern, ipattern38, ipattern311): + if sys.version_info >= (3, 8): + ipattern = ipattern38 ++ if sys.version_info >= (3, 11): ++ ipattern = ipattern311 + str, pattern = istr, ipattern + while '$' in pattern: + i = pattern.index('$') +@@ -1387,6 +1389,16 @@ Traceback (most recent call last): + File "$", line $, in check_value + $ + ValueError: 42 ++""", """\ ++Exception ignored from cffi callback : ++Traceback (most recent call last): ++ File "$", line $, in Zcb1 ++ $ ++ $ ++ File "$", line $, in check_value ++ $ ++ $ ++ValueError: 42 + """) + sys.stderr = cStringIO.StringIO() + bigvalue = 20000 +@@ -1401,6 +1413,13 @@ Traceback (most recent call last): + File "$", line $, in test_callback_exception + $ + OverflowError: integer 60000 does not fit 'short' ++""", """\ ++Exception ignored from cffi callback , trying to convert the result back to C: ++Traceback (most recent call last): ++ File "$", line $, in test_callback_exception ++ $ ++ $ ++OverflowError: integer 60000 does not fit 'short' + """) + sys.stderr = cStringIO.StringIO() + bigvalue = 20000 +@@ -1449,6 +1468,19 @@ Traceback (most recent call last): + File "$", line $, in test_callback_exception + $ + TypeError: $integer$ ++""", """\ ++Exception ignored from cffi callback , trying to convert the result back to C: ++Traceback (most recent call last): ++ File "$", line $, in test_callback_exception ++ $ ++ $ ++OverflowError: integer 60000 does not fit 'short' ++Exception ignored during handling of the above exception by 'onerror': ++Traceback (most recent call last): ++ File "$", line $, in test_callback_exception ++ $ ++ $ ++TypeError: $integer$ + """) + # + sys.stderr = cStringIO.StringIO() +@@ -1478,6 +1510,19 @@ Traceback (most recent call last): + File "$", line $, in oops + $ + AttributeError: 'str' object has no attribute 'append$ ++""", """\ ++Exception ignored from cffi callback , trying to convert the result back to C: ++Traceback (most recent call last): ++ File "$", line $, in test_callback_exception ++ $ ++ $ ++OverflowError: integer 60000 does not fit 'short' ++Exception ignored during handling of the above exception by 'onerror': ++Traceback (most recent call last): ++ File "$", line $, in oops ++ $ ++ $ ++AttributeError: 'str' object has no attribute 'append$ + """) + finally: + sys.stderr = orig_stderr +-- +GitLab + diff --git a/python-cffi.spec b/python-cffi.spec index d9ea6cc..fb31b79 100644 --- a/python-cffi.spec +++ b/python-cffi.spec @@ -1,11 +1,12 @@ Name: python-cffi %global general_version 1.15.0 Version: %{general_version}%{?prerel:~%{prerel}} -Release: 3%{?dist} +Release: 4%{?dist} Summary: Foreign Function Interface for Python to call C code License: MIT URL: https://cffi.readthedocs.org/ Source0: %{pypi_source cffi} +Patch1: https://foss.heptapod.net/pypy/cffi/-/commit/871bae572cafc3afb81eb13705945f0a6f708d54.patch BuildRequires: make BuildRequires: libffi-devel @@ -69,6 +70,10 @@ PYTHONPATH=%{buildroot}%{python3_sitearch} %{__python3} -m pytest c/ testing/ %doc doc/build/html %changelog +* Wed Feb 02 2022 Tomáš Hrnčiar - 1.15.0-4 +- Backport patch to fix compatibility with Python 3.11 +- Fixes: rhbz#2040165 + * Fri Jan 21 2022 Fedora Release Engineering - 1.15.0-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild