107 lines
3.3 KiB
Diff
107 lines
3.3 KiB
Diff
From 871bae572cafc3afb81eb13705945f0a6f708d54 Mon Sep 17 00:00:00 2001
|
|
From: Armin Rigo <arigo@tunes.org>
|
|
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 <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
|
|
@@ -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 <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
|
|
@@ -1449,6 +1468,19 @@ 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()
|
|
@@ -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 <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 oops
|
|
+ $
|
|
+ $
|
|
+AttributeError: 'str' object has no attribute 'append$
|
|
""")
|
|
finally:
|
|
sys.stderr = orig_stderr
|
|
--
|
|
GitLab
|
|
|