From 4f976ef9ee6bc2720083aa6e4327d008e59b363a Mon Sep 17 00:00:00 2001 From: Miro Hrončok Date: Jul 15 2022 14:14:24 +0000 Subject: Adjust tests for a last minute Python 3.11 change in the traceback format --- diff --git a/113.patch b/113.patch new file mode 100644 index 0000000..477ae3e --- /dev/null +++ b/113.patch @@ -0,0 +1,95 @@ +From 8a3c2c816d789639b49d3ae867213393ed7abdff Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Fri, 15 Jul 2022 16:11:37 +0200 +Subject: [PATCH] Adjust tests for a last minute Python 3.11 change in the + traceback format + +See https://github.com/python/cpython/issues/93883 +and https://github.com/python/cpython/pull/93994 + +--HG-- +branch : python3.11.0b4 +--- + c/test_c.py | 35 ++--------------------------------- + 1 file changed, 2 insertions(+), 33 deletions(-) + +diff --git a/c/test_c.py b/c/test_c.py +index cde83b80..048711c7 100644 +--- a/c/test_c.py ++++ b/c/test_c.py +@@ -1342,11 +1342,11 @@ def test_callback_exception(): + except ImportError: + import io as cStringIO # Python 3 + import linecache +- def matches(istr, ipattern, ipattern38, ipattern311): ++ def matches(istr, ipattern, ipattern38, ipattern311=None): + if sys.version_info >= (3, 8): + ipattern = ipattern38 + if sys.version_info >= (3, 11): +- ipattern = ipattern311 ++ ipattern = ipattern311 or ipattern38 + str, pattern = istr, ipattern + while '$' in pattern: + i = pattern.index('$') +@@ -1400,16 +1400,6 @@ 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 +@@ -1424,13 +1414,6 @@ 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 +@@ -1479,19 +1462,6 @@ 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() +@@ -1526,7 +1496,6 @@ Exception ignored from cffi callback , trying to convert t + 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): +-- +GitLab + diff --git a/python-cffi.spec b/python-cffi.spec index 7b5c476..68ebf87 100644 --- a/python-cffi.spec +++ b/python-cffi.spec @@ -1,12 +1,15 @@ Name: python-cffi %global general_version 1.15.1 Version: %{general_version}%{?prerel:~%{prerel}} -Release: 0%{?dist} +Release: 1%{?dist} Summary: Foreign Function Interface for Python to call C code License: MIT URL: https://cffi.readthedocs.org/ Source0: %{pypi_source cffi} +# Adjust tests for a last minute Python 3.11 change in the traceback format +Patch: https://foss.heptapod.net/pypy/cffi/-/merge_requests/113.patch + BuildRequires: make BuildRequires: libffi-devel BuildRequires: gcc @@ -69,6 +72,9 @@ PYTHONPATH=%{buildroot}%{python3_sitearch} %{__python3} -m pytest c/ testing/ %doc doc/build/html %changelog +* Fri Jul 15 2022 Miro Hrončok - 1.15.1-1 +- Adjust tests for a last minute Python 3.11 change in the traceback format + * Mon Jul 11 2022 Lumír Balhar - 1.15.1-0 - Update to 1.15.1 Resolves: rhbz#2102824