- update to 1.12.3

- drop patches: 3184b0a675fc425b821b528d7fdf744b2f08dadf.patch
                7a76a381534012af4790e815140d1538510b7d93.patch
                e2e324a2f13e3a646de6f6ff03e90ed7d37e2636.patch
 * Direct support for pkg-config.
 * ffi.from_buffer() takes a new optional first argument that gives the array
    type of the result. It also takes an optional keyword argument require_writable
    to refuse read-only Python buffers.
 * ffi.new(), ffi.gc() or ffi.from_buffer() cdata objects can now be released
    at known times, either by using the with keyword or by calling the new ffi.release().
 * Accept an expression like ffi.new("int[4]", p) if p is itself another cdata int[4].
 * CPython 2.x: ffi.dlopen() failed with non-ascii file names on Posix
 * CPython: if a thread is started from C and then runs Python code
    (with callbacks or with the embedding solution), then previous versions of cffi
    would contain possible crashes and/or memory leaks.
 * Support for ffi.cdef(..., pack=N) where N is a power of two.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cffi?expand=0&rev=59
This commit is contained in:
Ondřej Súkup 2019-03-02 10:48:08 +00:00 committed by Git OBS Bridge
parent 0c76d6df2a
commit 3bca1778c0
7 changed files with 25 additions and 119 deletions

View File

@ -1,46 +0,0 @@
# HG changeset patch
# User Armin Rigo <arigo@tunes.org>
# Date 1536839482 -7200
# Node ID 3184b0a675fc425b821b528d7fdf744b2f08dadf
# Parent 97a61f7b0bcd48eb74f136280ffd8733e829f153
Issue 378
Workaround for a GCC bug
diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c
--- a/c/_cffi_backend.c
+++ b/c/_cffi_backend.c
@@ -892,11 +892,21 @@
return 0;
}
+#ifdef __GNUC__
+/* This is a workaround for what I think is a GCC bug on several
+ platforms. See issue #378. */
+__attribute__((noinline))
+#endif
+void _cffi_memcpy(char *target, const void *src, size_t size)
+{
+ memcpy(target, src, size);
+}
+
#define _write_raw_data(type) \
do { \
if (size == sizeof(type)) { \
type r = (type)source; \
- memcpy(target, &r, sizeof(type)); \
+ _cffi_memcpy(target, &r, sizeof(type)); \
return; \
} \
} while(0)
@@ -970,8 +980,8 @@
if (size == 2*sizeof(type)) { \
type r = (type)source.real; \
type i = (type)source.imag; \
- memcpy(target, &r, sizeof(type)); \
- memcpy(target+sizeof(type), &i, sizeof(type)); \
+ _cffi_memcpy(target, &r, sizeof(type)); \
+ _cffi_memcpy(target+sizeof(type), &i, sizeof(type)); \
return; \
} \
} while(0)

View File

@ -1,29 +0,0 @@
# HG changeset patch
# User Armin Rigo <arigo@tunes.org>
# Date 1536088314 -7200
# Node ID 7a76a381534012af4790e815140d1538510b7d93
# Parent ef09637b23147f63a7d3fda628fa1704c97f1c72
Issue #382
Second fix attempt, thanks Adam
--- a/testing/cffi0/test_function.py
+++ b/testing/cffi0/test_function.py
@@ -45,14 +45,14 @@ class TestFunction(object):
assert x != math.sin(1.23) # rounding effects
assert abs(x - math.sin(1.23)) < 1E-6
- def test_sin_no_return_value(self):
+ def test_lround_no_return_value(self):
# check that 'void'-returning functions work too
ffi = FFI(backend=self.Backend())
ffi.cdef("""
- void sin(double x);
+ void lround(double x);
""")
m = ffi.dlopen(lib_m)
- x = m.sin(1.23)
+ x = m.lround(1.23)
assert x is None
def test_dlopen_filename(self):

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e90f17980e6ab0f3c2f3730e56d1fe9bcba1891eeea58966e89d352492cc74f4
size 438498

3
cffi-1.12.2.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e113878a446c6228669144ae8a56e268c91b7f1fafae927adc4879d9849e0ea7
size 453893

View File

@ -1,32 +0,0 @@
# HG changeset patch
# User Armin Rigo <arigo@tunes.org>
# Date 1537369554 -7200
# Node ID e2e324a2f13e3a646de6f6ff03e90ed7d37e2636
# Parent 8076f2ac1bd2b68b7015fb1fb936bd6907946756
Issue #384
Un-ignore the warnings when testing for them, in case someone runs
py.test with the PYTHONWARNINGS environment variable set
diff --git a/c/test_c.py b/c/test_c.py
--- a/c/test_c.py
+++ b/c/test_c.py
@@ -3968,6 +3968,7 @@
z3 = cast(BVoidP, 0)
z4 = cast(BUCharP, 0)
with warnings.catch_warnings(record=True) as w:
+ warnings.simplefilter("always")
newp(new_pointer_type(BIntP), z1) # warn
assert len(w) == 1
newp(new_pointer_type(BVoidP), z1) # fine
diff --git a/testing/cffi0/backend_tests.py b/testing/cffi0/backend_tests.py
--- a/testing/cffi0/backend_tests.py
+++ b/testing/cffi0/backend_tests.py
@@ -1386,6 +1386,7 @@
ffi = FFI(backend=self.Backend())
ffi.cdef("enum foo;")
with warnings.catch_warnings(record=True) as log:
+ warnings.simplefilter("always")
n = ffi.cast("enum foo", -1)
assert int(n) == 0xffffffff
assert str(log[0].message) == (

View File

@ -1,3 +1,23 @@
-------------------------------------------------------------------
Sat Mar 2 10:39:31 UTC 2019 - Ondřej Súkup <mimi.vx@gmail.com>
- update to 1.12.3
- drop patches: 3184b0a675fc425b821b528d7fdf744b2f08dadf.patch
7a76a381534012af4790e815140d1538510b7d93.patch
e2e324a2f13e3a646de6f6ff03e90ed7d37e2636.patch
* Direct support for pkg-config.
* ffi.from_buffer() takes a new optional first argument that gives the array
type of the result. It also takes an optional keyword argument require_writable
to refuse read-only Python buffers.
* ffi.new(), ffi.gc() or ffi.from_buffer() cdata objects can now be released
at known times, either by using the with keyword or by calling the new ffi.release().
* Accept an expression like ffi.new("int[4]", p) if p is itself another cdata int[4].
* CPython 2.x: ffi.dlopen() failed with non-ascii file names on Posix
* CPython: if a thread is started from C and then runs Python code
(with callbacks or with the embedding solution), then previous versions of cffi
would contain possible crashes and/or memory leaks.
* Support for ffi.cdef(..., pack=N) where N is a power of two.
-------------------------------------------------------------------
Mon Oct 29 16:10:03 CET 2018 - mcepl@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package python-cffi
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -18,7 +18,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-cffi
Version: 1.11.5
Version: 1.12.2
Release: 0
Summary: Foreign Function Interface for Python calling C code
License: MIT
@ -26,12 +26,6 @@ Group: Development/Languages/Python
URL: http://cffi.readthedocs.org
Source0: https://files.pythonhosted.org/packages/source/c/cffi/cffi-%{version}.tar.gz
Source1: python-cffi-rpmlintrc
# https://bitbucket.org/cffi/cffi/issues/384/
Patch0: e2e324a2f13e3a646de6f6ff03e90ed7d37e2636.patch
# https://bitbucket.org/cffi/cffi/issues/378
Patch1: 3184b0a675fc425b821b528d7fdf744b2f08dadf.patch
# https://bitbucket.org/cffi/cffi/issues/382/test_sin_no_return_value-violates-calling
Patch2: 7a76a381534012af4790e815140d1538510b7d93.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module pycparser}
BuildRequires: %{python_module pytest}
@ -50,7 +44,6 @@ is to provide a convenient and reliable way of calling C code from Python.
%prep
%setup -q -n cffi-%{version}
%autopatch -p1
%build
export CFLAGS="%{optflags}"