Hello community, here is the log from the commit of package python-cffi for openSUSE:Factory checked in at 2018-02-25 11:35:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-cffi (Old) and /work/SRC/openSUSE:Factory/.python-cffi.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-cffi" Sun Feb 25 11:35:31 2018 rev:20 rq:578275 version:1.11.4 Changes: -------- --- /work/SRC/openSUSE:Factory/python-cffi/python-cffi.changes 2018-01-20 11:20:18.782324222 +0100 +++ /work/SRC/openSUSE:Factory/.python-cffi.new/python-cffi.changes 2018-02-25 11:35:32.685470672 +0100 @@ -1,0 +2,26 @@ +Tue Feb 20 00:23:55 UTC 2018 - [email protected] + +- specfile: + * delete patch cffi-loader.patch; included upstream + +- update to version 1.11.4: + * Windows: reverted linking with python3.dll, because virtualenv + does not make this DLL available to virtual environments for + now. See Issue #355. On Windows only, the C extension modules + created by cffi follow for now the standard naming scheme + foo.cp36-win32.pyd, to make it clear that they are regular CPython + modules depending on python36.dll. + +- changes from version 1.11.3: + * Fix on CPython 3.x: reading the attributes __loader__ or __spec__ + from the cffi-generated lib modules gave a buggy + SystemError. (These attributes are always None, and provided only + to help compatibility with tools that expect them in all modules.) + * More Windows fixes: workaround for MSVC not supporting large + literal strings in C code (from + ffi.embedding_init_code(large_string)); and an issue with + Py_LIMITED_API linking with python35.dll/python36.dll instead of + python3.dll. + * Small documentation improvements. + +------------------------------------------------------------------- Old: ---- cffi-1.11.2.tar.gz cffi-loader.patch New: ---- cffi-1.11.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-cffi.spec ++++++ --- /var/tmp/diff_new_pack.mIExGg/_old 2018-02-25 11:35:33.953424635 +0100 +++ /var/tmp/diff_new_pack.mIExGg/_new 2018-02-25 11:35:33.989423328 +0100 @@ -17,17 +17,15 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} -%define modname cffi -Name: python-%{modname} -Version: 1.11.2 +Name: python-cffi +Version: 1.11.4 Release: 0 Summary: Foreign Function Interface for Python calling C code License: MIT Group: Development/Languages/Python -Url: http://%{modname}.readthedocs.org -Source0: https://files.pythonhosted.org/packages/source/c/cffi/%{modname}-%{version}.tar.gz +Url: http://cffi.readthedocs.org +Source0: https://files.pythonhosted.org/packages/source/c/cffi/cffi-%{version}.tar.gz Source1: python-cffi-rpmlintrc -Patch0: cffi-loader.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module pycparser} BuildRequires: %{python_module pytest} @@ -44,8 +42,7 @@ is to provide a convenient and reliable way of calling C code from Python. %prep -%setup -q -n %{modname}-%{version} -%patch0 -p1 +%setup -q -n cffi-%{version} %build export CFLAGS="%{optflags}" ++++++ cffi-1.11.2.tar.gz -> cffi-1.11.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.11.2/PKG-INFO new/cffi-1.11.4/PKG-INFO --- old/cffi-1.11.2/PKG-INFO 2017-10-09 14:33:33.000000000 +0200 +++ new/cffi-1.11.4/PKG-INFO 2018-01-13 20:29:36.000000000 +0100 @@ -1,11 +1,12 @@ Metadata-Version: 1.1 Name: cffi -Version: 1.11.2 +Version: 1.11.4 Summary: Foreign Function Interface for Python calling C code. Home-page: http://cffi.readthedocs.org Author: Armin Rigo, Maciej Fijalkowski Author-email: [email protected] License: MIT +Description-Content-Type: UNKNOWN Description: CFFI ==== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.11.2/README.md new/cffi-1.11.4/README.md --- old/cffi-1.11.2/README.md 1970-01-01 01:00:00.000000000 +0100 +++ new/cffi-1.11.4/README.md 2018-01-13 20:28:57.000000000 +0100 @@ -0,0 +1,30 @@ +CFFI +==== + +Foreign Function Interface for Python calling C code. +Please see the [Documentation](http://cffi.readthedocs.org/) or uncompiled +in the doc/ subdirectory. + +Download +-------- + +[Download page](https://bitbucket.org/cffi/cffi/downloads) + +Contact +------- + +[Mailing list](https://groups.google.com/forum/#!forum/python-cffi) + +Testing/development tips +------------------------ + +To run tests under CPython, run:: + + pip install pytest # if you don't have py.test already + pip install pycparser + python setup.py build_ext -f -i + py.test c/ testing/ + +If you run in another directory (either the tests or another program), +you should use the environment variable ``PYTHONPATH=/path`` to point +to the location that contains the ``_cffi_backend.so`` just compiled. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.11.2/c/_cffi_backend.c new/cffi-1.11.4/c/_cffi_backend.c --- old/cffi-1.11.2/c/_cffi_backend.c 2017-10-09 14:33:26.000000000 +0200 +++ new/cffi-1.11.4/c/_cffi_backend.c 2018-01-13 20:28:57.000000000 +0100 @@ -2,7 +2,7 @@ #include <Python.h> #include "structmember.h" -#define CFFI_VERSION "1.11.2" +#define CFFI_VERSION "1.11.4" #ifdef MS_WIN32 #include <windows.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.11.2/c/lib_obj.c new/cffi-1.11.4/c/lib_obj.c --- old/cffi-1.11.2/c/lib_obj.c 2017-10-09 14:33:26.000000000 +0200 +++ new/cffi-1.11.4/c/lib_obj.c 2018-01-13 20:28:57.000000000 +0100 @@ -505,6 +505,7 @@ return x; missing: + /*** ATTRIBUTEERROR IS SET HERE ***/ p = PyText_AsUTF8(name); if (p == NULL) return NULL; @@ -534,6 +535,7 @@ #if PY_MAJOR_VERSION >= 3 if (strcmp(p, "__loader__") == 0 || strcmp(p, "__spec__") == 0) { /* some more module-like behavior hacks */ + PyErr_Clear(); Py_INCREF(Py_None); return Py_None; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.11.2/c/test_c.py new/cffi-1.11.4/c/test_c.py --- old/cffi-1.11.2/c/test_c.py 2017-10-09 14:33:26.000000000 +0200 +++ new/cffi-1.11.4/c/test_c.py 2018-01-13 20:28:57.000000000 +0100 @@ -12,7 +12,7 @@ # ____________________________________________________________ import sys -assert __version__ == "1.11.2", ("This test_c.py file is for testing a version" +assert __version__ == "1.11.4", ("This test_c.py file is for testing a version" " of cffi that differs from the one that we" " get from 'import _cffi_backend'") if sys.version_info < (3,): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.11.2/cffi/__init__.py new/cffi-1.11.4/cffi/__init__.py --- old/cffi-1.11.2/cffi/__init__.py 2017-10-09 14:33:26.000000000 +0200 +++ new/cffi-1.11.4/cffi/__init__.py 2018-01-13 20:28:57.000000000 +0100 @@ -4,8 +4,8 @@ from .api import FFI from .error import CDefError, FFIError, VerificationError, VerificationMissing -__version__ = "1.11.2" -__version_info__ = (1, 11, 2) +__version__ = "1.11.4" +__version_info__ = (1, 11, 4) # The verifier module file names are based on the CRC32 of a string that # contains the following version number. It may be older than __version__ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.11.2/cffi/_cffi_include.h new/cffi-1.11.4/cffi/_cffi_include.h --- old/cffi-1.11.2/cffi/_cffi_include.h 2017-10-09 14:33:26.000000000 +0200 +++ new/cffi-1.11.4/cffi/_cffi_include.h 2018-01-13 20:28:57.000000000 +0100 @@ -7,6 +7,16 @@ we can learn about Py_DEBUG from pyconfig.h, but it is unclear if the same works for the other two macros. Py_DEBUG implies them, but not the other way around. + + Issue #350 is still open: on Windows, the code here causes it to link + with PYTHON36.DLL (for example) instead of PYTHON3.DLL. A fix was + attempted in 164e526a5515 and 14ce6985e1c3, but reverted: virtualenv + does not make PYTHON3.DLL available, and so the "correctly" compiled + version would not run inside a virtualenv. We will re-apply the fix + after virtualenv has been fixed for some time. For explanation, see + issue #355. For a workaround if you want PYTHON3.DLL and don't worry + about virtualenv, see issue #350. See also 'py_limited_api' in + setuptools_ext.py. */ #if !defined(_CFFI_USE_EMBEDDING) && !defined(Py_LIMITED_API) # include <pyconfig.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.11.2/cffi/_embedding.h new/cffi-1.11.4/cffi/_embedding.h --- old/cffi-1.11.2/cffi/_embedding.h 2017-10-09 14:33:26.000000000 +0200 +++ new/cffi-1.11.4/cffi/_embedding.h 2018-01-13 20:28:57.000000000 +0100 @@ -247,7 +247,7 @@ if (f != NULL && f != Py_None) { PyFile_WriteString("\nFrom: " _CFFI_MODULE_NAME - "\ncompiled with cffi version: 1.11.2" + "\ncompiled with cffi version: 1.11.4" "\n_cffi_backend module: ", f); modules = PyImport_GetModuleDict(); mod = PyDict_GetItemString(modules, "_cffi_backend"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.11.2/cffi/recompiler.py new/cffi-1.11.4/cffi/recompiler.py --- old/cffi-1.11.2/cffi/recompiler.py 2017-10-09 14:33:26.000000000 +0200 +++ new/cffi-1.11.4/cffi/recompiler.py 2018-01-13 20:28:57.000000000 +0100 @@ -295,8 +295,9 @@ base_module_name = self.module_name.split('.')[-1] if self.ffi._embedding is not None: prnt('#define _CFFI_MODULE_NAME "%s"' % (self.module_name,)) - prnt('#define _CFFI_PYTHON_STARTUP_CODE %s' % - (self._string_literal(self.ffi._embedding),)) + prnt('static const char _CFFI_PYTHON_STARTUP_CODE[] = {') + self._print_string_literal_in_array(self.ffi._embedding) + prnt('0 };') prnt('#ifdef PYPY_VERSION') prnt('# define _CFFI_PYTHON_STARTUP_FUNC _cffi_pypyinit_%s' % ( base_module_name,)) @@ -1271,17 +1272,18 @@ _generate_cpy_extern_python_plus_c_ctx = \ _generate_cpy_extern_python_ctx - def _string_literal(self, s): - def _char_repr(c): - # escape with a '\' the characters '\', '"' or (for trigraphs) '?' - if c in '\\"?': return '\\' + c - if ' ' <= c < '\x7F': return c - if c == '\n': return '\\n' - return '\\%03o' % ord(c) - lines = [] - for line in s.splitlines(True) or ['']: - lines.append('"%s"' % ''.join([_char_repr(c) for c in line])) - return ' \\\n'.join(lines) + def _print_string_literal_in_array(self, s): + prnt = self._prnt + prnt('// # NB. this is not a string because of a size limit in MSVC') + for line in s.splitlines(True): + prnt(('// ' + line).rstrip()) + printed_line = '' + for c in line: + if len(printed_line) >= 76: + prnt(printed_line) + printed_line = '' + printed_line += '%d,' % (ord(c),) + prnt(printed_line) # ---------- # emitting the opcodes for individual types diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.11.2/cffi/setuptools_ext.py new/cffi-1.11.4/cffi/setuptools_ext.py --- old/cffi-1.11.2/cffi/setuptools_ext.py 2017-10-09 14:33:26.000000000 +0200 +++ new/cffi-1.11.4/cffi/setuptools_ext.py 2018-01-13 20:28:57.000000000 +0100 @@ -81,8 +81,13 @@ it doesn't so far, creating troubles. That's why we check for "not hasattr(sys, 'gettotalrefcount')" (the 2.7 compatible equivalent of 'd' not in sys.abiflags). (http://bugs.python.org/issue28401) + + On Windows, it's better not to use py_limited_api until issue #355 + can be resolved (by having virtualenv copy PYTHON3.DLL). See also + the start of _cffi_include.h. """ - if 'py_limited_api' not in kwds and not hasattr(sys, 'gettotalrefcount'): + if ('py_limited_api' not in kwds and not hasattr(sys, 'gettotalrefcount') + and sys.platform != 'win32'): import setuptools try: setuptools_major_version = int(setuptools.__version__.partition('.')[0]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.11.2/cffi/verifier.py new/cffi-1.11.4/cffi/verifier.py --- old/cffi-1.11.2/cffi/verifier.py 2017-10-09 14:33:26.000000000 +0200 +++ new/cffi-1.11.4/cffi/verifier.py 2018-01-13 20:28:57.000000000 +0100 @@ -301,7 +301,6 @@ return suffixes def _ensure_dir(filename): - try: - os.makedirs(os.path.dirname(filename)) - except OSError: - pass + dirname = os.path.dirname(filename) + if dirname and not os.path.isdir(dirname): + os.makedirs(dirname) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.11.2/cffi.egg-info/PKG-INFO new/cffi-1.11.4/cffi.egg-info/PKG-INFO --- old/cffi-1.11.2/cffi.egg-info/PKG-INFO 2017-10-09 14:33:33.000000000 +0200 +++ new/cffi-1.11.4/cffi.egg-info/PKG-INFO 2018-01-13 20:29:36.000000000 +0100 @@ -1,11 +1,12 @@ Metadata-Version: 1.1 Name: cffi -Version: 1.11.2 +Version: 1.11.4 Summary: Foreign Function Interface for Python calling C code. Home-page: http://cffi.readthedocs.org Author: Armin Rigo, Maciej Fijalkowski Author-email: [email protected] License: MIT +Description-Content-Type: UNKNOWN Description: CFFI ==== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.11.2/cffi.egg-info/SOURCES.txt new/cffi-1.11.4/cffi.egg-info/SOURCES.txt --- old/cffi-1.11.2/cffi.egg-info/SOURCES.txt 2017-10-09 14:33:33.000000000 +0200 +++ new/cffi-1.11.4/cffi.egg-info/SOURCES.txt 2018-01-13 20:29:36.000000000 +0100 @@ -1,6 +1,7 @@ AUTHORS LICENSE MANIFEST.in +README.md setup.py setup_base.py c/_cffi_backend.c @@ -102,6 +103,7 @@ doc/source/cdef.rst doc/source/conf.py doc/source/embedding.rst +doc/source/goals.rst doc/source/index.rst doc/source/installation.rst doc/source/overview.rst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.11.2/doc/source/cdef.rst new/cffi-1.11.4/doc/source/cdef.rst --- old/cffi-1.11.2/doc/source/cdef.rst 2017-10-09 14:33:26.000000000 +0200 +++ new/cffi-1.11.4/doc/source/cdef.rst 2018-01-13 20:28:57.000000000 +0100 @@ -701,7 +701,7 @@ ------------------------------- A few C libraries are actually hard to use correctly in a ``dlopen()`` -setting. This is because most C libraries are intented for, and tested +setting. This is because most C libraries are intended for, and tested with, a situation where they are *linked* with another program, using either static linking or dynamic linking --- but from a program written in C, at start-up, using the linker's capabilities instead of diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.11.2/doc/source/conf.py new/cffi-1.11.4/doc/source/conf.py --- old/cffi-1.11.2/doc/source/conf.py 2017-10-09 14:33:26.000000000 +0200 +++ new/cffi-1.11.4/doc/source/conf.py 2018-01-13 20:28:57.000000000 +0100 @@ -38,7 +38,7 @@ # General information about the project. project = u'CFFI' -copyright = u'2012-2015, Armin Rigo, Maciej Fijalkowski' +copyright = u'2012-2018, Armin Rigo, Maciej Fijalkowski' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -47,7 +47,7 @@ # The short X.Y version. version = '1.11' # The full version, including alpha/beta/rc tags. -release = '1.11.2' +release = '1.11.4' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.11.2/doc/source/embedding.rst new/cffi-1.11.4/doc/source/embedding.rst --- old/cffi-1.11.2/doc/source/embedding.rst 2017-10-09 14:33:26.000000000 +0200 +++ new/cffi-1.11.4/doc/source/embedding.rst 2018-01-13 20:28:57.000000000 +0100 @@ -279,12 +279,24 @@ Troubleshooting --------------- -The error message +* The error message cffi extension module 'c_module_name' has unknown version 0x2701 -means that the running Python interpreter located a CFFI version older -than 1.5. CFFI 1.5 or newer must be installed in the running Python. + means that the running Python interpreter located a CFFI version older + than 1.5. CFFI 1.5 or newer must be installed in the running Python. + +* On PyPy, the error message + + debug: pypy_setup_home: directories 'lib-python' and 'lib_pypy' not + found in pypy's shared library location or in any parent directory + + means that the ``libpypy-c.so`` file was found, but the standard library + was not found from this location. This occurs at least on some Linux + distributions, because they put ``libpypy-c.so`` inside ``/usr/lib/``, + instead of the way we recommend, which is: keep that file inside + ``/opt/pypy/bin/`` and put a symlink to there from ``/usr/lib/``. + The quickest fix is to do that change manually. Issues about using the .so diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.11.2/doc/source/goals.rst new/cffi-1.11.4/doc/source/goals.rst --- old/cffi-1.11.2/doc/source/goals.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/cffi-1.11.4/doc/source/goals.rst 2018-01-13 20:28:57.000000000 +0100 @@ -0,0 +1,62 @@ +Goals +----- + +The interface is based on `LuaJIT's FFI`_, and follows a few principles: + +* The goal is to call C code from Python without learning a 3rd language: + existing alternatives require users to learn domain specific language + (Cython_, SWIG_) or API (ctypes_). The CFFI design requires users to know + only C and Python, minimizing the extra bits of API that need to be learned. + +* Keep all the Python-related logic in Python so that you don't need to + write much C code (unlike `CPython native C extensions`_). + +* The preferred way is to work at the level of the API (Application + Programming Interface): the C compiler is called from the declarations + you write to validate and link to the C language constructs. + Alternatively, it is also possible to work at the ABI level + (Application Binary Interface), the way ctypes_ work. + However, on non-Windows platforms, C libraries typically + have a specified C API but not an ABI (e.g. they may + document a "struct" as having at least these fields, but maybe more). + +* Try to be complete. For now some C99 constructs are not supported, + but all C89 should be, including macros (and including macro "abuses", + which you can `manually wrap`_ in saner-looking C functions). + +* Attempt to support both PyPy and CPython, with a reasonable path + for other Python implementations like IronPython and Jython. + +* Note that this project is **not** about embedding executable C code in + Python, unlike `Weave`_. This is about calling existing C libraries + from Python. + +.. _`LuaJIT's FFI`: http://luajit.org/ext_ffi.html +.. _`Cython`: http://www.cython.org +.. _`SWIG`: http://www.swig.org/ +.. _`CPython native C extensions`: http://docs.python.org/extending/extending.html +.. _`native C extensions`: http://docs.python.org/extending/extending.html +.. _`ctypes`: http://docs.python.org/library/ctypes.html +.. _`Weave`: http://wiki.scipy.org/Weave +.. _`manually wrap`: overview.html#abi-versus-api + +Get started by reading `the overview`__. + +.. __: overview.html + + +Comments and bugs +----------------- + +The best way to contact us is on the IRC ``#pypy`` channel of +``irc.freenode.net``. Feel free to discuss matters either there or in +the `mailing list`_. Please report to the `issue tracker`_ any bugs. + +As a general rule, when there is a design issue to resolve, we pick the +solution that is the "most C-like". We hope that this module has got +everything you need to access C code and nothing more. + +--- the authors, Armin Rigo and Maciej Fijalkowski + +.. _`issue tracker`: https://bitbucket.org/cffi/cffi/issues +.. _`mailing list`: https://groups.google.com/forum/#!forum/python-cffi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.11.2/doc/source/index.rst new/cffi-1.11.4/doc/source/index.rst --- old/cffi-1.11.2/doc/source/index.rst 2017-10-09 14:33:26.000000000 +0200 +++ new/cffi-1.11.4/doc/source/index.rst 2018-01-13 20:28:57.000000000 +0100 @@ -6,13 +6,10 @@ code from Python, based on C-like declarations that you can often copy-paste from header files or documentation. -* Goals_ - - * `Comments and bugs`_ - .. toctree:: :maxdepth: 2 + goals whatsnew installation overview @@ -22,65 +19,4 @@ embedding -Goals ------ - -The interface is based on `LuaJIT's FFI`_, and follows a few principles: - -* The goal is to call C code from Python without learning a 3rd language: - existing alternatives require users to learn domain specific language - (Cython_, SWIG_) or API (ctypes_). The CFFI design requires users to know - only C and Python, minimizing the extra bits of API that need to be learned. - -* Keep all the Python-related logic in Python so that you don't need to - write much C code (unlike `CPython native C extensions`_). - -* The preferred way is to work at the level of the API (Application - Programming Interface): the C compiler is called from the declarations - you write to validate and link to the C language constructs. - Alternatively, it is also possible to work at the ABI level - (Application Binary Interface), the way ctypes_ work. - However, on non-Windows platforms, C libraries typically - have a specified C API but not an ABI (e.g. they may - document a "struct" as having at least these fields, but maybe more). - -* Try to be complete. For now some C99 constructs are not supported, - but all C89 should be, including macros (and including macro "abuses", - which you can `manually wrap`_ in saner-looking C functions). - -* Attempt to support both PyPy and CPython, with a reasonable path - for other Python implementations like IronPython and Jython. - -* Note that this project is **not** about embedding executable C code in - Python, unlike `Weave`_. This is about calling existing C libraries - from Python. - -.. _`LuaJIT's FFI`: http://luajit.org/ext_ffi.html -.. _`Cython`: http://www.cython.org -.. _`SWIG`: http://www.swig.org/ -.. _`CPython native C extensions`: http://docs.python.org/extending/extending.html -.. _`native C extensions`: http://docs.python.org/extending/extending.html -.. _`ctypes`: http://docs.python.org/library/ctypes.html -.. _`Weave`: http://wiki.scipy.org/Weave -.. _`manually wrap`: overview.html#abi-versus-api - -Get started by reading `the overview`__. - -.. __: overview.html - - -Comments and bugs ------------------ - -The best way to contact us is on the IRC ``#pypy`` channel of -``irc.freenode.net``. Feel free to discuss matters either there or in -the `mailing list`_. Please report to the `issue tracker`_ any bugs. - -As a general rule, when there is a design issue to resolve, we pick the -solution that is the "most C-like". We hope that this module has got -everything you need to access C code and nothing more. - ---- the authors, Armin Rigo and Maciej Fijalkowski -.. _`issue tracker`: https://bitbucket.org/cffi/cffi/issues -.. _`mailing list`: https://groups.google.com/forum/#!forum/python-cffi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.11.2/doc/source/installation.rst new/cffi-1.11.4/doc/source/installation.rst --- old/cffi-1.11.2/doc/source/installation.rst 2017-10-09 14:33:26.000000000 +0200 +++ new/cffi-1.11.4/doc/source/installation.rst 2018-01-13 20:28:57.000000000 +0100 @@ -53,7 +53,7 @@ * https://pypi.python.org/pypi/cffi -* Checksums of the "source" package version 1.11.2: +* Checksums of the "source" package version 1.11.4: - MD5: ... @@ -114,7 +114,7 @@ PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig pip install cffi -Aternatively, **on OS/X 10.6** (Thanks Juraj Sukop for this) +Alternatively, **on OS/X 10.6** (Thanks Juraj Sukop for this) For building libffi you can use the default install path, but then, in ``setup.py`` you need to change:: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.11.2/doc/source/overview.rst new/cffi-1.11.4/doc/source/overview.rst --- old/cffi-1.11.2/doc/source/overview.rst 2017-10-09 14:33:26.000000000 +0200 +++ new/cffi-1.11.4/doc/source/overview.rst 2018-01-13 20:28:57.000000000 +0100 @@ -45,8 +45,9 @@ there, %s!\n"``. In general it is ``somestring.encode(myencoding)``. *Python 3 on Windows:* ``ffi.dlopen(None)`` does not work. This problem -is messy and not really fixable. The example above could be fixed by -calling another function from a specific DLL that exists on your system. +is messy and not really fixable. The problem does not occur if you try +to call a fucntion from a specific DLL that exists on your system: then +you use ``ffi.dlopen("path.dll")``. *This example does not call any C compiler. It works in the so-called ABI mode, which means that it will crash if you call some function or @@ -76,20 +77,27 @@ ffibuilder = FFI() ffibuilder.set_source("_example", - r""" // passed to the real C compiler + r""" // passed to the real C compiler, + // contains implementation of things declared in cdef() #include <sys/types.h> #include <pwd.h> + + struct passwd *get_pw_for_root(void) { + return getpwuid(0); + } """, libraries=[]) # or a list of libraries to link with # (more arguments like setup.py's Extension class: # include_dirs=[..], extra_objects=[..], and so on) - ffibuilder.cdef(""" // some declarations from the man page + ffibuilder.cdef(""" + // declarations that are shared between Python and C struct passwd { char *pw_name; ...; // literally dot-dot-dot }; - struct passwd *getpwuid(int uid); + struct passwd *getpwuid(int uid); // defined in <pwd.h> + struct passwd *get_pw_for_root(void); // defined in set_source() """) if __name__ == "__main__": @@ -113,15 +121,18 @@ p = lib.getpwuid(0) assert ffi.string(p.pw_name) == b'root' + p = lib.get_pw_for_root() + assert ffi.string(p.pw_name) == b'root' Note that this works independently of the exact C layout of ``struct passwd`` (it is "API level", as opposed to "ABI level"). It requires a C compiler in order to run ``example_build.py``, but it is much more portable than trying to get the details of the fields of ``struct -passwd`` exactly right. Similarly, we declared ``getpwuid()`` as -taking an ``int`` argument. On some platforms this might be slightly -incorrect---but it does not matter. It is also faster than the ABI -mode. +passwd`` exactly right. Similarly, in the ``cdef()`` we declared +``getpwuid()`` as taking an ``int`` argument; on some platforms this +might be slightly incorrect---but it does not matter. + +Note also that at runtime, the API mode is faster than the ABI mode. To integrate it inside a ``setup.py`` distribution with Setuptools: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.11.2/doc/source/ref.rst new/cffi-1.11.4/doc/source/ref.rst --- old/cffi-1.11.2/doc/source/ref.rst 2017-10-09 14:33:26.000000000 +0200 +++ new/cffi-1.11.4/doc/source/ref.rst 2018-01-13 20:28:57.000000000 +0100 @@ -401,7 +401,12 @@ nothing gets out of sync if the size estimates do not match. It only makes the next GC start more or less early. +Note that if you have several ``ffi.gc()`` objects, the corresponding +destructors will be called in a random order. If you need a particular +order, see the discussion in `issue 340`__. + .. __: http://bugs.python.org/issue31105 +.. __: https://bitbucket.org/cffi/cffi/issues/340/resources-release-issues .. _ffi-new-handle: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.11.2/doc/source/using.rst new/cffi-1.11.4/doc/source/using.rst --- old/cffi-1.11.2/doc/source/using.rst 2017-10-09 14:33:26.000000000 +0200 +++ new/cffi-1.11.4/doc/source/using.rst 2018-01-13 20:28:57.000000000 +0100 @@ -28,7 +28,7 @@ *New in version 1.11:* in addition to ``wchar_t``, the C types ``char16_t`` and ``char32_t`` work the same but with a known fixed size. In previous versions, this could be achieved using ``uint16_t`` and -``int32_t`` but without automatic convertion to Python unicodes. +``int32_t`` but without automatic conversion to Python unicodes. Pointers, structures and arrays are more complex: they don't have an obvious Python equivalent. Thus, they correspond to objects of type diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.11.2/doc/source/whatsnew.rst new/cffi-1.11.4/doc/source/whatsnew.rst --- old/cffi-1.11.2/doc/source/whatsnew.rst 2017-10-09 14:33:26.000000000 +0200 +++ new/cffi-1.11.4/doc/source/whatsnew.rst 2018-01-13 20:28:57.000000000 +0100 @@ -2,6 +2,35 @@ What's New ====================== +v1.11.4 +======= + +* Windows: reverted linking with ``python3.dll``, because + virtualenv does not make this DLL available to virtual environments + for now. See `Issue #355`_. On Windows only, the C extension + modules created by cffi follow for now the standard naming scheme + ``foo.cp36-win32.pyd``, to make it clear that they are regular + CPython modules depending on ``python36.dll``. + +.. _`Issue #355`: https://bitbucket.org/cffi/cffi/issues/355/ + + +v1.11.3 +======= + +* Fix on CPython 3.x: reading the attributes ``__loader__`` or + ``__spec__`` from the cffi-generated lib modules gave a buggy + SystemError. (These attributes are always None, and provided only to + help compatibility with tools that expect them in all modules.) + +* More Windows fixes: workaround for MSVC not supporting large + literal strings in C code (from + ``ffi.embedding_init_code(large_string)``); and an issue with + ``Py_LIMITED_API`` linking with ``python35.dll/python36.dll`` instead + of ``python3.dll``. + +* Small documentation improvements. + v1.11.2 ======= @@ -78,8 +107,11 @@ .. __: http://bugs.python.org/issue31105 +Older Versions +============== + v1.10.1 -======= +------- (only released inside PyPy 5.8.0) @@ -90,7 +122,7 @@ v1.10 -===== +----- * Issue #295: use calloc() directly instead of PyObject_Malloc()+memset() to handle ffi.new() with a default @@ -152,7 +184,7 @@ v1.9 -==== +---- * Structs with variable-sized arrays as their last field: now we track the length of the array after ``ffi.new()`` is called, just like we @@ -187,7 +219,7 @@ v1.8.3 -====== +------ * When passing a ``void *`` argument to a function with a different pointer type, or vice-versa, the cast occurs automatically, like in C. @@ -200,7 +232,7 @@ v1.8.2 -====== +------ * Issue #283: fixed ``ffi.new()`` on structures/unions with nested anonymous structures/unions, when there is at least one union in @@ -209,7 +241,7 @@ v1.8.1 -====== +------ * CPython 3.x: experimental: the generated C extension modules now use the "limited API", which means that, as a compiled .so/.dll, it should @@ -224,7 +256,7 @@ v1.8 -==== +---- * Removed the restriction that ``ffi.from_buffer()`` cannot be used on byte strings. Now you can get a ``char *`` out of a byte string, @@ -238,7 +270,7 @@ v1.7 -==== +---- * ``ffi.gc(p, None)`` removes the destructor on an object previously created by another call to ``ffi.gc()`` @@ -267,7 +299,7 @@ v1.6 -==== +---- * `ffi.list_types()`_ @@ -290,13 +322,13 @@ v1.5.2 -====== +------ * Fix 1.5.1 for Python 2.6. v1.5.1 -====== +------ * A few installation-time tweaks (thanks Stefano!) @@ -308,7 +340,7 @@ v1.5.0 -====== +------ * Support for `using CFFI for embedding`__. @@ -316,13 +348,13 @@ v1.4.2 -====== +------ Nothing changed from v1.4.1. v1.4.1 -====== +------ * Fix the compilation failure of cffi on CPython 3.5.0. (3.5.1 works; some detail changed that makes some underscore-starting macros @@ -332,7 +364,7 @@ v1.4.0 -====== +------ * A `better way to do callbacks`__ has been added (faster and more portable, and usually cleaner). It is a mechanism for the @@ -373,7 +405,7 @@ v1.3.1 -====== +------ * The optional typedefs (``bool``, ``FILE`` and all Windows types) were not always available from out-of-line FFI objects. @@ -389,7 +421,7 @@ v1.3.0 -====== +------ * Added `ffi.memmove()`_. @@ -424,13 +456,13 @@ v1.2.1 -====== +------ Nothing changed from v1.2.0. v1.2.0 -====== +------ * Out-of-line mode: ``int a[][...];`` can be used to declare a structure field or global variable which is, simultaneously, of total length @@ -483,14 +515,14 @@ v1.1.2 -====== +------ * ``ffi.gc()``: fixed a race condition in multithreaded programs introduced in 1.1.1 v1.1.1 -====== +------ * Out-of-line mode: ``ffi.string()``, ``ffi.buffer()`` and ``ffi.getwinerror()`` didn't accept their arguments as keyword @@ -508,7 +540,7 @@ v1.1.0 -====== +------ * Out-of-line API mode: we can now declare integer types with ``typedef int... foo_t;``. The exact size and signedness of ``foo_t`` @@ -541,13 +573,13 @@ v1.0.3 -====== +------ * Same as 1.0.2, apart from doc and test fixes on some platforms. v1.0.2 -====== +------ * Variadic C functions (ending in a "..." argument) were not supported in the out-of-line ABI mode. This was a bug---there was even a @@ -557,7 +589,7 @@ v1.0.1 -====== +------ * ``ffi.set_source()`` crashed if passed a ``sources=[..]`` argument. Fixed by chrippa on pull request #60. @@ -570,7 +602,7 @@ v1.0.0 -====== +------ * The main news item is out-of-line module generation: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.11.2/setup.py new/cffi-1.11.4/setup.py --- old/cffi-1.11.2/setup.py 2017-10-09 14:33:26.000000000 +0200 +++ new/cffi-1.11.4/setup.py 2018-01-13 20:28:57.000000000 +0100 @@ -186,7 +186,7 @@ `Mailing list <https://groups.google.com/forum/#!forum/python-cffi>`_ """, - version='1.11.2', + version='1.11.4', packages=['cffi'] if cpython else [], package_data={'cffi': ['_cffi_include.h', 'parse_c_type.h', '_embedding.h', '_cffi_errors.h']} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.11.2/testing/cffi1/test_recompiler.py new/cffi-1.11.4/testing/cffi1/test_recompiler.py --- old/cffi-1.11.2/testing/cffi1/test_recompiler.py 2017-10-09 14:33:26.000000000 +0200 +++ new/cffi-1.11.4/testing/cffi1/test_recompiler.py 2018-01-13 20:28:57.000000000 +0100 @@ -2270,7 +2270,7 @@ char32_t foo_4bytes(char32_t); """) lib = verify(ffi, "test_char16_char32_type" + no_cpp * "_nocpp", """ - #if !defined(__cplusplus) || __cplusplus < 201103L + #if !defined(__cplusplus) || (!defined(_LIBCPP_VERSION) && __cplusplus < 201103L) typedef uint_least16_t char16_t; typedef uint_least32_t char32_t; #endif @@ -2287,3 +2287,13 @@ def test_char16_char32_plain_c(): test_char16_char32_type(no_cpp=True) + +def test_loader_spec(): + ffi = FFI() + lib = verify(ffi, "test_loader_spec", "") + if sys.version_info < (3,): + assert not hasattr(lib, '__loader__') + assert not hasattr(lib, '__spec__') + else: + assert lib.__loader__ is None + assert lib.__spec__ is None
