[pypy-commit] cffi cffi-1.0: test and fix
arigo
noreply at buildbot.pypy.org
Tue May 12 16:14:41 CEST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch: cffi-1.0
Changeset: r1995:27b0150bc868
Date: 2015-05-12 16:12 +0200
http://bitbucket.org/cffi/cffi/changeset/27b0150bc868/
Log: test and fix
diff --git a/cffi/recompiler.py b/cffi/recompiler.py
--- a/cffi/recompiler.py
+++ b/cffi/recompiler.py
@@ -888,10 +888,14 @@
self._generate_cpy_const(True, name, check_value=check_value)
def _generate_cpy_macro_ctx(self, tp, name):
+ if tp == '...':
+ check_value = None
+ else:
+ check_value = tp # an integer
type_op = CffiOp(OP_CONSTANT_INT, -1)
self._lsts["global"].append(
GlobalExpr(name, '_cffi_const_%s' % name, type_op,
- check_value=tp))
+ check_value=check_value))
# ----------
# global variables
diff --git a/testing/cffi1/test_dlopen.py b/testing/cffi1/test_dlopen.py
--- a/testing/cffi1/test_dlopen.py
+++ b/testing/cffi1/test_dlopen.py
@@ -28,3 +28,14 @@
"ffi.dlopen() will not be able to figure out "
"the value of constant 'BB' (only integer constants are "
"supported, and only if their value are specified in the cdef)")
+
+def test_invalid_dotdotdot_in_macro():
+ ffi = FFI()
+ ffi.cdef("#define FOO ...")
+ target = udir.join('test_invalid_dotdotdot_in_macro.py')
+ e = py.test.raises(VerificationError, make_py_source, ffi,
+ 'test_invalid_dotdotdot_in_macro', str(target))
+ assert str(e.value) == (
+ "ffi.dlopen() will not be able to figure out "
+ "the value of constant 'FOO' (only integer constants are "
+ "supported, and only if their value are specified in the cdef)")
More information about the pypy-commit
mailing list