From 1037cbd86ea1ff656ee9637abbce9408a69dfec41dfdb7de45a6944d1875f640 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Fri, 6 Jan 2023 09:01:16 +0000 Subject: [PATCH] - add 8a3c2c816d789639b49d3ae867213393ed7abdff.patch to resolve testsuite failures with Python 3.11 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cffi?expand=0&rev=87 --- ...2c816d789639b49d3ae867213393ed7abdff.patch | 95 +++++++++++++++++++ python-cffi.changes | 6 ++ python-cffi.spec | 5 +- 3 files changed, 104 insertions(+), 2 deletions(-) create mode 100644 8a3c2c816d789639b49d3ae867213393ed7abdff.patch diff --git a/8a3c2c816d789639b49d3ae867213393ed7abdff.patch b/8a3c2c816d789639b49d3ae867213393ed7abdff.patch new file mode 100644 index 0000000..68b7cf0 --- /dev/null +++ b/8a3c2c816d789639b49d3ae867213393ed7abdff.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.changes b/python-cffi.changes index ca8c764..13a809a 100644 --- a/python-cffi.changes +++ b/python-cffi.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Jan 6 08:59:54 UTC 2023 - Dirk Müller + +- add 8a3c2c816d789639b49d3ae867213393ed7abdff.patch to resolve + testsuite failures with Python 3.11 + ------------------------------------------------------------------- Mon Dec 5 12:22:40 UTC 2022 - Daniel Garcia diff --git a/python-cffi.spec b/python-cffi.spec index 9ddce94..fae483f 100644 --- a/python-cffi.spec +++ b/python-cffi.spec @@ -1,7 +1,7 @@ # # spec file for package python-cffi # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -25,6 +25,7 @@ License: MIT URL: https://cffi.readthedocs.org Source0: https://files.pythonhosted.org/packages/source/c/cffi/cffi-%{version}.tar.gz Source1: python-cffi-rpmlintrc +Patch1: https://foss.heptapod.net/pypy/cffi/-/commit/8a3c2c816d789639b49d3ae867213393ed7abdff.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module pycparser} BuildRequires: %{python_module pytest} @@ -43,7 +44,7 @@ Foreign Function Interface for Python calling C code. The aim of this project is to provide a convenient and reliable way of calling C code from Python. %prep -%setup -q -n cffi-%{version} +%autosetup -p1 -n cffi-%{version} %build export CFLAGS="%{optflags}"