Source: python-cffi Version: 1.15.1-1 Severity: important Tags: ftbfs fixed-upstream User: debian-pyt...@lists.debian.org Usertags: python3.11
Hi Maintainer python-cffi will FTBFS once Python 3.11 is added as a supported version. I've copied what I hope is the relevant part of the log below. This appears to be fixed upstream already [1], although not yet in a release. Regards Graham [1] https://foss.heptapod.net/pypy/cffi/-/commit/8a3c2c816d789639b49d3ae867213393ed7abdff =================================== FAILURES =================================== ___________________________ test_callback_exception ____________________________ def test_callback_exception(): try: import cStringIO except ImportError: import io as cStringIO # Python 3 import linecache 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('$') assert str[:i] == pattern[:i] j = str.find(pattern[i+1], i) assert i + 1 <= j <= str.find('\n', i) str = str[j:] pattern = pattern[i+1:] assert str == pattern return True def check_value(x): if x == 10000: raise ValueError(42) def Zcb1(x): check_value(x) return x * 3 BShort = new_primitive_type("short") BFunc = new_function_type((BShort,), BShort, False) f = callback(BFunc, Zcb1, -42) # seen = [] oops_result = None def oops(*args): seen.append(args) return oops_result ff = callback(BFunc, Zcb1, -42, oops) # orig_stderr = sys.stderr orig_getline = linecache.getline try: linecache.getline = lambda *args: 'LINE' # hack: speed up PyPy tests sys.stderr = cStringIO.StringIO() if hasattr(sys, '__unraisablehook__'): # work around pytest sys.unraisablehook = sys.__unraisablehook__ # on recent CPythons assert f(100) == 300 assert sys.stderr.getvalue() == '' assert f(10000) == -42 > assert matches(sys.stderr.getvalue(), """\ From cffi callback <function$Zcb1 at 0x$>: Traceback (most recent call last): File "$", line $, in Zcb1 $ 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 """, """\ 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 """) c/test_c.py:1387: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ istr = 'Exception ignored from cffi callback <function test_callback_exception.<locals>.Zcb1 at 0x7f1149b839c0>:\nTraceback (...est/python-cffi/python-cffi-1.15.1/c/test_c.py", line 1362, in check_value\n raise> ipattern = 'Exception ignored from cffi callback <function$Zcb1 at 0x$>:\nTraceback (most recent call last):\n File "$", line $, in Zcb1\n $\n $\n File "$", line $, in check_value\n $\n $\nValueError> ipattern38 = 'Exception ignored from cffi callback <function$Zcb1 at 0x$>:\nTraceback (most recent call last):\n File "$", line $, in Zcb1\n $\n File "$", line $, in check_value\n $\nValueError: 42\n' ipattern311 = 'Exception ignored from cffi callback <function$Zcb1 at 0x$>:\nTraceback (most recent call last):\n File "$", line $, in Zcb1\n $\n $\n File "$", line $, in check_value\n $\n $\nValueEr> 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('$') > assert str[:i] == pattern[:i] E AssertionError: assert '\n Fi' == '\n ' E Strings contain only whitespace, escaping them using repr() E - '\n ' E ? ^^ E + '\n Fi' E ? ^^ c/test_c.py:1353: AssertionError