Hi all,
CFFI 1.8.2 has been released. (Versions 1.8 and 1.8.1 are only inside
PyPy 5.4.0 and 5.4.1, which have been released recently.)
Two main changes:
* On CPython 3.x, the C extension modules generated by cffi (not cffi
itself!) are now using CPython's official "limited C API". This means
that the same compiled .so/.dll should work without recompilation on
any version >= 3.2. The name produced by distutils is still
version-specific. To get the version-independent name, you can rename
it manually to ``
NAME.abi3.so``, or use the very recent setuptools 26.
* ffi.from_buffer() can now be used on byte strings, getting the
``char *`` address of the C string directly. This was not allowed
because PyPy couldn't support it---we can make the string non-movable,
but the blocker was that the strings in PyPy are not zero-terminated!
So from PyPy 5.4 all strings are allocated with space for one extra
character---an extremely minor overhead---and we write a zero at the
end when ffi.from_buffer() is called. Similarly, when we call
``lib.func("abc")``, PyPy would always make a copy of the string
because the original wasn't zero-terminated; now neither PyPy nor
CPython need to duplicate the string.
A bientôt,
Armin.