Compare commits

..

4 Commits
f36 ... rawhide

Author SHA1 Message Date
Fedora Release Engineering
42efcca609 Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-07-22 17:14:34 +00:00
Miro Hrončok
4f976ef9ee Adjust tests for a last minute Python 3.11 change in the traceback format 2022-07-15 16:14:24 +02:00
Lumir Balhar
3ab6ef4f81 Update to 1.15.1 2022-07-11 11:20:45 +02:00
Python Maint
b68667442d Rebuilt for Python 3.11 2022-06-13 18:18:30 +02:00
5 changed files with 115 additions and 173 deletions

95
113.patch Normal file
View File

@ -0,0 +1,95 @@
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
---
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 <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

View File

@ -1,59 +0,0 @@
From 4d0cc66daf88f477f3a11262d0e2e093f9397e2c Mon Sep 17 00:00:00 2001
From: Armin Rigo <arigo@tunes.org>
Date: Tue, 29 Mar 2022 11:48:33 +0200
Subject: [PATCH] Issue #531
on ppc64le, libffi requires 16 bytes alignment for at least the return
value of functions if that is 'long double'.
---
c/_cffi_backend.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c
index ffecbf9a..ce2cacd9 100644
--- a/c/_cffi_backend.c
+++ b/c/_cffi_backend.c
@@ -5665,7 +5665,8 @@ static ffi_type *fb_fill_type(struct funcbuilder_s *fb, CTypeDescrObject *ct,
}
}
-#define ALIGN_ARG(n) ((n) + 7) & ~7
+#define ALIGN_TO(n, a) ((n) + ((a)-1)) & ~((a)-1)
+#define ALIGN_ARG(n) ALIGN_TO(n, 8)
static int fb_build(struct funcbuilder_s *fb, PyObject *fargs,
CTypeDescrObject *fresult)
@@ -5690,10 +5691,12 @@ static int fb_build(struct funcbuilder_s *fb, PyObject *fargs,
/* exchange data size */
/* first, enough room for an array of 'nargs' pointers */
exchange_offset = nargs * sizeof(void*);
+ /* then enough room for the result --- which means at least
+ sizeof(ffi_arg), according to the ffi docs, but we also
+ align according to the result type, for issue #531 */
+ exchange_offset = ALIGN_TO(exchange_offset, fb->rtype->alignment);
exchange_offset = ALIGN_ARG(exchange_offset);
cif_descr->exchange_offset_arg[0] = exchange_offset;
- /* then enough room for the result --- which means at least
- sizeof(ffi_arg), according to the ffi docs */
i = fb->rtype->size;
if (i < (Py_ssize_t)sizeof(ffi_arg))
i = sizeof(ffi_arg);
@@ -5721,6 +5724,7 @@ static int fb_build(struct funcbuilder_s *fb, PyObject *fargs,
if (fb->atypes != NULL) {
fb->atypes[i] = atype;
/* exchange data size */
+ exchange_offset = ALIGN_TO(exchange_offset, atype->alignment);
exchange_offset = ALIGN_ARG(exchange_offset);
cif_descr->exchange_offset_arg[1 + i] = exchange_offset;
exchange_offset += atype->size;
@@ -5737,6 +5741,7 @@ static int fb_build(struct funcbuilder_s *fb, PyObject *fargs,
}
#undef ALIGN_ARG
+#undef ALIGN_TO
static void fb_cat_name(struct funcbuilder_s *fb, const char *piece,
int piecelen)
--
GitLab

View File

@ -1,106 +0,0 @@
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

View File

@ -1,17 +1,16 @@
Name: python-cffi
%global general_version 1.15.0
%global general_version 1.15.1
Version: %{general_version}%{?prerel:~%{prerel}}
Release: 5%{?dist}
Release: 2%{?dist}
Summary: Foreign Function Interface for Python to call C code
License: MIT
URL: https://cffi.readthedocs.org/
Source0: %{pypi_source cffi}
Patch1: https://foss.heptapod.net/pypy/cffi/-/commit/871bae572cafc3afb81eb13705945f0a6f708d54.patch
# on ppc64le, libffi requires 16 bytes alignment for at least the return
# value of functions if that is 'long double':
Patch2: https://foss.heptapod.net/pypy/cffi/-/commit/4d0cc66daf88f477f3a11262d0e2e093f9397e2c.patch
BuildRequires: make
# 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
@ -73,6 +72,19 @@ PYTHONPATH=%{buildroot}%{python3_sitearch} %{__python3} -m pytest c/ testing/
%doc doc/build/html
%changelog
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.15.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Fri Jul 15 2022 Miro Hrončok <mhroncok@redhat.com> - 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 <lbalhar@redhat.com> - 1.15.1-0
- Update to 1.15.1
Resolves: rhbz#2102824
* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 1.15.0-6
- Rebuilt for Python 3.11
* Wed Mar 30 2022 Miro Hrončok <mhroncok@redhat.com> - 1.15.0-5
- Fix alignment issue on ppc64le
- Fixes: rhbz#2046865

View File

@ -1 +1 @@
SHA512 (cffi-1.15.0.tar.gz) = ee83efde6f77f4a0c5889088c4c208ed7b9071fe06dfc16a8d2396de07f78fe859e1e39866760198a9d700f3b7359e8715e8a3e4907feb81d3fc4b8dd0dbaca1
SHA512 (cffi-1.15.1.tar.gz) = e99cafcb029076abc29e435b490fa0573ee2856f4051b7ca8a5b38cd125d56dd9dae8b189f59ceb3d728a675da8ee83239e09e19f8b0feeddea4b186ab5173a5