[pypy-commit] cffi cffi-1.0: hg merge default

arigo noreply at buildbot.pypy.org
Thu Apr 30 01:21:52 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: cffi-1.0
Changeset: r1889:1d37117fd28c
Date: 2015-04-30 01:22 +0200
http://bitbucket.org/cffi/cffi/changeset/1d37117fd28c/

Log:	hg merge default

diff --git a/doc/source/index.rst b/doc/source/index.rst
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -437,9 +437,9 @@
   types ``TBYTE TCHAR LPCTSTR PCTSTR LPTSTR PTSTR PTBYTE PTCHAR`` are no
   longer automatically defined; see ``ffi.set_unicode()`` below.
 
-* *New in version 0.9:* the other standard integer types from stdint.h,
+* *New in version 0.9.3:* the other standard integer types from stdint.h,
   as long as they map to integers of 1, 2, 4 or 8 bytes.  Larger integers
-  are not supported.
+  are not supported.  (Actually added in version 0.9 but this was buggy.)
 
 .. _`common Windows types`: http://msdn.microsoft.com/en-us/library/windows/desktop/aa383751%28v=vs.85%29.aspx
 
@@ -1078,6 +1078,23 @@
     C.printf("hello, %f\n", ffi.cast("double", 42))
     C.printf("hello, %s\n", ffi.new("char[]", "world"))
 
+Note that if you are using ``dlopen()``, the function declaration in the
+``cdef()`` must match the original one in C exactly, as usual --- in
+particular, if this function is variadic in C, then its ``cdef()``
+declaration must also be variadic.  You cannot declare it in the
+``cdef()`` with fixed arguments instead, even if you plan to only call
+it with these argument types.  The reason is that some architectures
+have a different calling convention depending on whether the function
+signature is fixed or not.  (On x86-64, the difference can sometimes be
+seen in PyPy's JIT-generated code if some arguments are ``double``.)
+
+Note that the function signature ``int foo();`` is interpreted by CFFI
+as equivalent to ``int foo(void);``.  This differs from the C standard,
+in which ``int foo();`` is really like ``int foo(...);`` and can be
+called with any arguments.  (This feature of C is a pre-C89 relic: the
+arguments cannot be accessed at all in the body of ``foo()`` without
+relying on compiler-specific extensions.)
+
 
 Callbacks
 ---------
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -19,7 +19,7 @@
         p = subprocess.Popen([pkg_config, option, 'libffi'],
                              stdout=subprocess.PIPE)
     except OSError as e:
-        if e.errno != errno.ENOENT:
+        if e.errno not in [errno.ENOENT, errno.EACCES]:
             raise
     else:
         t = p.stdout.read().decode().strip()


More information about the pypy-commit mailing list