Author: Armin Rigo <[email protected]>
Branch:
Changeset: r77467:2bcf56036762
Date: 2015-05-22 00:55 +0200
http://bitbucket.org/pypy/pypy/changeset/2bcf56036762/
Log: import cffi 1.0.2 again
diff --git a/lib_pypy/cffi/_cffi_include.h b/lib_pypy/cffi/_cffi_include.h
--- a/lib_pypy/cffi/_cffi_include.h
+++ b/lib_pypy/cffi/_cffi_include.h
@@ -1,3 +1,4 @@
+#define _CFFI_
#include <Python.h>
#ifdef __cplusplus
extern "C" {
diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py
b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py
--- a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py
+++ b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py
@@ -762,3 +762,18 @@
py.test.raises(AttributeError, ffi.addressof, lib, 'unknown_var')
py.test.raises(AttributeError, ffi.addressof, lib, "FOOBAR")
assert ffi.addressof(lib, 'FetchRectBottom') == lib.FetchRectBottom
+
+def test_defines__CFFI_():
+ # Check that we define the macro _CFFI_ automatically.
+ # It should be done before including Python.h, so that PyPy's Python.h
+ # can check for it.
+ ffi = FFI()
+ ffi.cdef("""
+ #define CORRECT 1
+ """)
+ lib = verify(ffi, "test_defines__CFFI_", """
+ #ifdef _CFFI_
+ # define CORRECT 1
+ #endif
+ """)
+ assert lib.CORRECT == 1
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit