Accepting request 398818 from devel:languages:python

1

OBS-URL: https://build.opensuse.org/request/show/398818
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-cffi?expand=0&rev=14
This commit is contained in:
Dominique Leuenberger 2016-05-31 10:11:58 +00:00 committed by Git OBS Bridge
commit 1d06b49b21
5 changed files with 74 additions and 5 deletions

View File

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

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

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

View File

@ -0,0 +1,39 @@
# HG changeset patch
# User Armin Rigo <arigo@tunes.org>
# Date 1464590378 -7200
# Node ID bc14c64da0f41ba70f6fab821540b376f78e0a85
# Parent f6d4b0a1e70b885352de186fcaeedf41365793c6
Issue #260: don't use "x << 0" but "x | 0" to check that x is an
integer. It seems that "x << 0" is undefined, according to the C
standard, if x is any negative value...
diff --git a/cffi/recompiler.py b/cffi/recompiler.py
--- a/cffi/recompiler.py
+++ b/cffi/recompiler.py
@@ -814,7 +814,7 @@
try:
if ftype.is_integer_type() or fbitsize >= 0:
# accept all integers, but complain on float or double
- prnt(" (void)((p->%s) << 1); /* check that '%s.%s' is "
+ prnt(" (void)((p->%s) | 0); /* check that '%s.%s' is "
"an integer */" % (fname, cname, fname))
continue
# only accept exactly the type declared, except that '[]'
@@ -991,7 +991,7 @@
prnt('static int %s(unsigned long long *o)' % funcname)
prnt('{')
prnt(' int n = (%s) <= 0;' % (name,))
- prnt(' *o = (unsigned long long)((%s) << 0);'
+ prnt(' *o = (unsigned long long)((%s) | 0);'
' /* check that %s is an integer */' % (name, name))
if check_value is not None:
if check_value > 0:
@@ -1250,7 +1250,7 @@
def _emit_bytecode_UnknownIntegerType(self, tp, index):
s = ('_cffi_prim_int(sizeof(%s), (\n'
- ' ((%s)-1) << 0 /* check that %s is an integer type */\n'
+ ' ((%s)-1) | 0 /* check that %s is an integer type */\n'
' ) <= 0)' % (tp.name, tp.name, tp.name))
self.cffi_types[index] = CffiOp(OP_PRIMITIVE, s)

View File

@ -1,3 +1,30 @@
-------------------------------------------------------------------
Sun May 29 05:23:27 UTC 2016 - badshah400@gmail.com
- Add python-cffi-avoid-bitshifting-negative-int.patch to actually
fix the "negative left shift" warning by replacing bitshifting
in appropriate places by bitwise and comparison to self; patch
taken from upstream git. Drop cffi-1.5.2-wnoerror.patch: no
longer required.
-------------------------------------------------------------------
Fri May 27 13:00:22 UTC 2016 - jmatejek@suse.com
- disable "negative left shift" warning in test suite to prevent
failures with gcc6, until upstream fixes the undefined code
in question (boo#981848, cffi-1.5.2-wnoerror.patch)
-------------------------------------------------------------------
Thu May 26 02:33:02 UTC 2016 - badshah400@gmail.com
- Update to version 1.6.0:
* ffi.list_types()
* ffi.unpack()
* extern “Python+C”
* in API mode, lib.foo.__doc__ contains the C signature now.
* Yet another attempt at robustness of ffi.def_extern() against
CPythons interpreter shutdown logic.
-------------------------------------------------------------------
Mon Apr 11 14:45:11 UTC 2016 - jmatejek@suse.com

View File

@ -17,14 +17,16 @@
Name: python-cffi
Version: 1.5.2
Version: 1.6.0
Release: 0
Summary: Foreign Function Interface for Python calling C code
License: MIT
Group: Development/Languages/Python
Url: http://cffi.readthedocs.org
Source0: https://pypi.python.org/packages/source/c/cffi/cffi-%{version}.tar.gz
Source0: https://pypi.io/packages/source/c/cffi/cffi-%{version}.tar.gz
Source1: python-cffi-rpmlintrc
# PATCH-FIX-UPSTREAM python-cffi-avoid-bitshifting-negative-int.patch boo#981848 badshah400@gmail.com -- Use bitwise AND instead of bitshifts to test for integer types; patch submitted upstream
Patch0: python-cffi-avoid-bitshifting-negative-int.patch
BuildRequires: gcc-c++
BuildRequires: python-devel
BuildRequires: python-setuptools
@ -47,6 +49,7 @@ is to provide a convenient and reliable way of calling C code from Python.
%prep
%setup -q -n cffi-%{version}
%patch0 -p1
%build
CFLAGS="%{optflags}" python setup.py build