summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-04-05 01:56:04 +0100
committerSam James <sam@gentoo.org>2023-04-05 01:56:23 +0100
commiteb99a6b05973202d0597295ebc2b4b246f28ea7c (patch)
tree6b0fdc3430d8adea84e96317c51f748f93d41a8f
parentsys-apps/util-linux: add 2.39_rc2, drop 2.39_rc1 (diff)
downloadgentoo-eb99a6b05973202d0597295ebc2b4b246f28ea7c.tar.gz
gentoo-eb99a6b05973202d0597295ebc2b4b246f28ea7c.tar.bz2
gentoo-eb99a6b05973202d0597295ebc2b4b246f28ea7c.zip
dev-python/cffi: fix tests w/ python3.11
This actually *did* work when 3.11 was added to the ebuild but upstream (cpython) made a last-minute change so it ended up breaking later. Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--dev-python/cffi/cffi-1.15.1-r1.ebuild1
-rw-r--r--dev-python/cffi/files/cffi-1.15.1-python3.11-tests.patch90
2 files changed, 91 insertions, 0 deletions
diff --git a/dev-python/cffi/cffi-1.15.1-r1.ebuild b/dev-python/cffi/cffi-1.15.1-r1.ebuild
index fc58f4f7e3fb..192186933382 100644
--- a/dev-python/cffi/cffi-1.15.1-r1.ebuild
+++ b/dev-python/cffi/cffi-1.15.1-r1.ebuild
@@ -39,6 +39,7 @@ distutils_enable_tests pytest
PATCHES=(
"${FILESDIR}"/cffi-1.14.0-darwin-no-brew.patch
"${FILESDIR}"/${P}-hppa.patch
+ "${FILESDIR}"/${P}-python3.11-tests.patch
)
src_prepare() {
diff --git a/dev-python/cffi/files/cffi-1.15.1-python3.11-tests.patch b/dev-python/cffi/files/cffi-1.15.1-python3.11-tests.patch
new file mode 100644
index 000000000000..e3be1c247877
--- /dev/null
+++ b/dev-python/cffi/files/cffi-1.15.1-python3.11-tests.patch
@@ -0,0 +1,90 @@
+https://foss.heptapod.net/pypy/cffi/-/commit/8a3c2c816d789639b49d3ae867213393ed7abdff
+
+From 8a3c2c816d789639b49d3ae867213393ed7abdff Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
+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
+--- 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 <function$Zcb1 at 0x$>:
+-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 <function$Zcb1 at 0x$>, 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 <function$Zcb1 at 0x$>, 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 <function$Zcb1 at 0x$>, 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