Hello community, here is the log from the commit of package python-cffi for openSUSE:Factory checked in at 2019-11-22 10:26:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-cffi (Old) and /work/SRC/openSUSE:Factory/.python-cffi.new.26869 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-cffi" Fri Nov 22 10:26:09 2019 rev:29 rq:749648 version:1.13.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-cffi/python-cffi.changes 2019-11-04 17:06:03.480238796 +0100 +++ /work/SRC/openSUSE:Factory/.python-cffi.new.26869/python-cffi.changes 2019-11-22 10:26:11.821259876 +0100 @@ -1,0 +2,10 @@ +Mon Nov 18 20:21:04 UTC 2019 - Todd R <toddrme2...@gmail.com> + +- Update to 1.13.2: + * re-release because the Linux wheels came with an attached version of libffi that was very old and buggy +- Update to 1.13.1: + * deprecate the way to declare in cdef() a global variable with only void *foo;. You should always use a storage class, like extern void *foo; or maybe static void *foo;. These are all equivalent for the purposes of cdef(), but the reason for deprecating the bare version is that (as far as I know) it would always be mistake in a real C header. + * fix the regression RuntimeError: found a situation in which we try to build a type recursively. + * fixed issue #427 where a multithreading mistake in the embedding logic initialization code would cause deadlocks on CPython 3.7. + +------------------------------------------------------------------- Old: ---- cffi-1.13.0.tar.gz New: ---- cffi-1.13.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-cffi.spec ++++++ --- /var/tmp/diff_new_pack.dE9ZNG/_old 2019-11-22 10:26:12.821259582 +0100 +++ /var/tmp/diff_new_pack.dE9ZNG/_new 2019-11-22 10:26:12.829259579 +0100 @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-cffi -Version: 1.13.0 +Version: 1.13.2 Release: 0 Summary: Foreign Function Interface for Python calling C code License: MIT ++++++ cffi-1.13.0.tar.gz -> cffi-1.13.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.13.0/PKG-INFO new/cffi-1.13.2/PKG-INFO --- old/cffi-1.13.0/PKG-INFO 2019-10-15 11:29:36.000000000 +0200 +++ new/cffi-1.13.2/PKG-INFO 2019-11-03 15:24:33.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: cffi -Version: 1.13.0 +Version: 1.13.2 Summary: Foreign Function Interface for Python calling C code. Home-page: http://cffi.readthedocs.org Author: Armin Rigo, Maciej Fijalkowski diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.13.0/c/_cffi_backend.c new/cffi-1.13.2/c/_cffi_backend.c --- old/cffi-1.13.0/c/_cffi_backend.c 2019-10-15 11:27:46.000000000 +0200 +++ new/cffi-1.13.2/c/_cffi_backend.c 2019-11-03 15:22:31.000000000 +0100 @@ -2,7 +2,7 @@ #include <Python.h> #include "structmember.h" -#define CFFI_VERSION "1.13.0" +#define CFFI_VERSION "1.13.2" #ifdef MS_WIN32 #include <windows.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.13.0/c/realize_c_type.c new/cffi-1.13.2/c/realize_c_type.c --- old/cffi-1.13.0/c/realize_c_type.c 2019-10-15 11:27:46.000000000 +0200 +++ new/cffi-1.13.2/c/realize_c_type.c 2019-11-03 15:22:31.000000000 +0100 @@ -631,14 +631,6 @@ break; } - case 255: /* recursion detection */ - PyErr_Format(PyExc_RuntimeError, - "found a situation in which we try to build a type recursively. " - "This is known to occur e.g. in ``struct s { void(*callable)" - "(struct s); }''. Please report if you get this error and " - "really need support for your case."); - return NULL; - default: PyErr_Format(PyExc_NotImplementedError, "op=%d", (int)_CFFI_GETOP(op)); return NULL; @@ -647,6 +639,8 @@ return x; } +static int _realize_recursion_level; + static PyObject * realize_c_type_or_func(builder_c_t *builder, _cffi_opcode_t opcodes[], int index) @@ -660,10 +654,17 @@ return x; } - opcodes[index] = (_cffi_opcode_t)255; /* recursion detection */ + if (_realize_recursion_level >= 1000) { + PyErr_Format(PyExc_RuntimeError, + "type-building recursion too deep or infinite. " + "This is known to occur e.g. in ``struct s { void(*callable)" + "(struct s); }''. Please report if you get this error and " + "really need support for your case."); + return NULL; + } + _realize_recursion_level++; x = realize_c_type_or_func_now(builder, op, opcodes, index); - if (opcodes[index] == (_cffi_opcode_t)255) - opcodes[index] = op; + _realize_recursion_level--; if (x != NULL && opcodes == builder->ctx.types && opcodes[index] != x) { assert((((uintptr_t)x) & 1) == 0); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.13.0/c/test_c.py new/cffi-1.13.2/c/test_c.py --- old/cffi-1.13.0/c/test_c.py 2019-10-15 11:27:46.000000000 +0200 +++ new/cffi-1.13.2/c/test_c.py 2019-11-03 15:22:31.000000000 +0100 @@ -14,7 +14,7 @@ # ____________________________________________________________ import sys -assert __version__ == "1.13.0", ("This test_c.py file is for testing a version" +assert __version__ == "1.13.2", ("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.13.0/cffi/__init__.py new/cffi-1.13.2/cffi/__init__.py --- old/cffi-1.13.0/cffi/__init__.py 2019-10-15 11:27:46.000000000 +0200 +++ new/cffi-1.13.2/cffi/__init__.py 2019-11-03 15:22:31.000000000 +0100 @@ -5,8 +5,8 @@ from .error import CDefError, FFIError, VerificationError, VerificationMissing from .error import PkgConfigError -__version__ = "1.13.0" -__version_info__ = (1, 13, 0) +__version__ = "1.13.2" +__version_info__ = (1, 13, 2) # 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.13.0/cffi/_embedding.h new/cffi-1.13.2/cffi/_embedding.h --- old/cffi-1.13.0/cffi/_embedding.h 2019-10-15 11:27:46.000000000 +0200 +++ new/cffi-1.13.2/cffi/_embedding.h 2019-11-03 15:22:31.000000000 +0100 @@ -224,7 +224,7 @@ if (f != NULL && f != Py_None) { PyFile_WriteString("\nFrom: " _CFFI_MODULE_NAME - "\ncompiled with cffi version: 1.13.0" + "\ncompiled with cffi version: 1.13.2" "\n_cffi_backend module: ", f); modules = PyImport_GetModuleDict(); mod = PyDict_GetItemString(modules, "_cffi_backend"); @@ -327,13 +327,15 @@ #endif /* call Py_InitializeEx() */ - { - PyGILState_STATE state = PyGILState_UNLOCKED; - if (!Py_IsInitialized()) - _cffi_py_initialize(); - else - state = PyGILState_Ensure(); - + if (!Py_IsInitialized()) { + _cffi_py_initialize(); + PyEval_InitThreads(); + PyEval_SaveThread(); /* release the GIL */ + /* the returned tstate must be the one that has been stored into the + autoTLSkey by _PyGILState_Init() called from Py_Initialize(). */ + } + else { + PyGILState_STATE state = PyGILState_Ensure(); PyEval_InitThreads(); PyGILState_Release(state); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.13.0/cffi/cparser.py new/cffi-1.13.2/cffi/cparser.py --- old/cffi-1.13.0/cffi/cparser.py 2019-10-15 11:27:46.000000000 +0200 +++ new/cffi-1.13.2/cffi/cparser.py 2019-11-03 15:22:31.000000000 +0100 @@ -156,6 +156,13 @@ "confuse pre-parsing.") break +def _warn_for_non_extern_non_static_global_variable(decl): + if not decl.storage: + import warnings + warnings.warn("Global variable '%s' in cdef(): for consistency " + "with C it should have a storage class specifier " + "(usually 'extern')" % (decl.name,)) + def _preprocess(csource): # Remove comments. NOTE: this only work because the cdef() section # should not contain any string literal! @@ -506,6 +513,7 @@ if (quals & model.Q_CONST) and not tp.is_array_type: self._declare('constant ' + decl.name, tp, quals=quals) else: + _warn_for_non_extern_non_static_global_variable(decl) self._declare('variable ' + decl.name, tp, quals=quals) def parse_type(self, cdecl): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.13.0/cffi.egg-info/PKG-INFO new/cffi-1.13.2/cffi.egg-info/PKG-INFO --- old/cffi-1.13.0/cffi.egg-info/PKG-INFO 2019-10-15 11:29:36.000000000 +0200 +++ new/cffi-1.13.2/cffi.egg-info/PKG-INFO 2019-11-03 15:24:33.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: cffi -Version: 1.13.0 +Version: 1.13.2 Summary: Foreign Function Interface for Python calling C code. Home-page: http://cffi.readthedocs.org Author: Armin Rigo, Maciej Fijalkowski diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.13.0/doc/source/cdef.rst new/cffi-1.13.2/doc/source/cdef.rst --- old/cffi-1.13.0/doc/source/cdef.rst 2019-10-15 11:27:46.000000000 +0200 +++ new/cffi-1.13.2/doc/source/cdef.rst 2019-11-03 15:22:31.000000000 +0100 @@ -512,14 +512,14 @@ field; then you would use "``typedef struct { ...; } foo_t;``". * array lengths: when used as structure fields or in global variables, - arrays can have an unspecified length, as in "``int n[...];``". The + arrays can have an unspecified length, as in "``extern int n[...];``". The length is completed by the C compiler. - This is slightly different from "``int n[];``", because the latter + This is slightly different from "``extern int n[];``", because the latter means that the length is not known even to the C compiler, and thus no attempt is made to complete it. This supports - multidimensional arrays: "``int n[...][...];``". + multidimensional arrays: "``extern int n[...][...];``". - *New in version 1.2:* "``int m[][...];``", i.e. ``...`` can be used + *New in version 1.2:* "``extern int m[][...];``", i.e. ``...`` can be used in the innermost dimensions without being also used in the outermost dimension. In the example given, the length of the ``m`` array is assumed not to be known to the C compiler, but the length of every @@ -568,8 +568,8 @@ For more complex types, you have no choice but be precise. For example, you cannot misdeclare a ``int *`` argument as ``long *``, or a global -array ``int a[5];`` as ``long a[5];``. CFFI considers `all types listed -above`_ as primitive (so ``long long a[5];`` and ``int64_t a[5]`` are +array ``extern int a[5];`` as ``extern long a[5];``. CFFI considers `all types listed +above`_ as primitive (so ``extern long long a[5];`` and ``extern int64_t a[5]`` are different declarations). The reason for that is detailed in `a comment about an issue.`__ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.13.0/doc/source/conf.py new/cffi-1.13.2/doc/source/conf.py --- old/cffi-1.13.0/doc/source/conf.py 2019-10-15 11:27:46.000000000 +0200 +++ new/cffi-1.13.2/doc/source/conf.py 2019-11-03 15:22:31.000000000 +0100 @@ -47,7 +47,7 @@ # The short X.Y version. version = '1.13' # The full version, including alpha/beta/rc tags. -release = '1.13.0' +release = '1.13.2' # 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.13.0/doc/source/installation.rst new/cffi-1.13.2/doc/source/installation.rst --- old/cffi-1.13.0/doc/source/installation.rst 2019-10-15 11:27:46.000000000 +0200 +++ new/cffi-1.13.2/doc/source/installation.rst 2019-11-03 15:22:31.000000000 +0100 @@ -52,7 +52,7 @@ * https://pypi.python.org/pypi/cffi -* Checksums of the "source" package version 1.13.0: +* Checksums of the "source" package version 1.13.2: - MD5: ... diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.13.0/doc/source/whatsnew.rst new/cffi-1.13.2/doc/source/whatsnew.rst --- old/cffi-1.13.0/doc/source/whatsnew.rst 2019-10-15 11:27:46.000000000 +0200 +++ new/cffi-1.13.2/doc/source/whatsnew.rst 2019-11-03 15:22:31.000000000 +0100 @@ -2,6 +2,34 @@ What's New ====================== +v1.13.2 +======= + +* re-release because the Linux wheels came with an attached version of libffi + that was very old and buggy (`issue #432`_). + +.. _`issue #432`: https://bitbucket.org/cffi/cffi/issues/432/ + + + +v1.13.1 +======= + +* deprecate the way to declare in ``cdef()`` a global variable with only + ``void *foo;``. You should always use a storage class, like ``extern void + *foo;`` or maybe ``static void *foo;``. These are all equivalent for + the purposes of ``cdef()``, but the reason for deprecating the bare version + is that (as far as I know) it would always be mistake in a real C header. + +* fix the regression ``RuntimeError: found a situation in which we try + to build a type recursively`` (`issue #429`_). + +* fixed `issue #427`_ where a multithreading mistake in the embedding logic + initialization code would cause deadlocks on CPython 3.7. + +.. _`issue #429`: https://bitbucket.org/cffi/cffi/issues/429/ +.. _`issue #427`: https://bitbucket.org/cffi/cffi/issues/427/ + v1.13 ===== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.13.0/setup.py new/cffi-1.13.2/setup.py --- old/cffi-1.13.0/setup.py 2019-10-15 11:27:46.000000000 +0200 +++ new/cffi-1.13.2/setup.py 2019-11-03 15:22:31.000000000 +0100 @@ -198,7 +198,7 @@ `Mailing list <https://groups.google.com/forum/#!forum/python-cffi>`_ """, - version='1.13.0', + version='1.13.2', 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.13.0/testing/cffi0/test_function.py new/cffi-1.13.2/testing/cffi0/test_function.py --- old/cffi-1.13.0/testing/cffi0/test_function.py 2019-10-15 11:27:46.000000000 +0200 +++ new/cffi-1.13.2/testing/cffi0/test_function.py 2019-11-03 15:22:31.000000000 +0100 @@ -113,7 +113,7 @@ ffi = FFI(backend=self.Backend()) ffi.cdef(""" int fputs(const char *, void *); - void *stderr; + extern void *stderr; """) needs_dlopen_none() ffi.C = ffi.dlopen(None) @@ -130,7 +130,7 @@ ffi = FFI(backend=self.Backend()) ffi.cdef(""" int fputs(char *, void *); - void *stderr; + extern void *stderr; """) needs_dlopen_none() ffi.C = ffi.dlopen(None) @@ -147,7 +147,7 @@ ffi = FFI(backend=self.Backend()) ffi.cdef(""" int fprintf(void *, const char *format, ...); - void *stderr; + extern void *stderr; """) needs_dlopen_none() ffi.C = ffi.dlopen(None) @@ -209,7 +209,7 @@ py.test.skip("probably no symbol 'stderr' in the lib") ffi.cdef(""" int fputs(const char *, void *); - void *stderr; + extern void *stderr; """) needs_dlopen_none() ffi.C = ffi.dlopen(None) @@ -256,7 +256,7 @@ py.test.skip("probably no symbol 'stdout' in the lib") ffi = FFI(backend=self.Backend()) ffi.cdef(""" - void *stdout; + extern void *stdout; """) needs_dlopen_none() C = ffi.dlopen(None) @@ -496,7 +496,7 @@ ffi.cdef(""" typedef enum { MYE1, MYE2 } myenum_t; double myfunc(double); - double myvar; + extern double myvar; const double myconst; #define MYFOO 42 """) @@ -507,7 +507,7 @@ if self.Backend is CTypesBackend: py.test.skip("not with the ctypes backend") ffi = FFI(backend=self.Backend()) - ffi.cdef("int foobar(void); int foobaz;") + ffi.cdef("int foobar(void); extern int foobaz;") lib = ffi.dlopen(lib_m) ffi.dlclose(lib) e = py.test.raises(ValueError, getattr, lib, 'foobar') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.13.0/testing/cffi0/test_ownlib.py new/cffi-1.13.2/testing/cffi0/test_ownlib.py --- old/cffi-1.13.0/testing/cffi0/test_ownlib.py 2019-10-15 11:27:46.000000000 +0200 +++ new/cffi-1.13.2/testing/cffi0/test_ownlib.py 2019-11-03 15:22:31.000000000 +0100 @@ -201,7 +201,7 @@ py.test.skip("fix the auto-generation of the tiny test lib") ffi = FFI(backend=self.Backend()) ffi.cdef(""" - int my_array[7]; + extern int my_array[7]; """) ownlib = ffi.dlopen(self.module) for i in range(7): @@ -223,7 +223,7 @@ py.test.skip("not supported by the ctypes backend") ffi = FFI(backend=self.Backend()) ffi.cdef(""" - int my_array[]; + extern int my_array[]; """) ownlib = ffi.dlopen(self.module) for i in range(7): @@ -291,7 +291,7 @@ long bottom; } RECT; - long left, top, right, bottom; + extern long left, top, right, bottom; RECT ReturnRect(int i, RECT ar, RECT* br, POINT cp, RECT dr, RECT *er, POINT fp, RECT gr); @@ -321,7 +321,7 @@ if self.Backend is CTypesBackend: py.test.skip("not implemented with the ctypes backend") ffi = FFI(backend=self.Backend()) - ffi.cdef("long left; int test_getting_errno(void);") + ffi.cdef("extern long left; int test_getting_errno(void);") lib = ffi.dlopen(self.module) lib.left = 123456 p = ffi.addressof(lib, "left") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.13.0/testing/cffi0/test_parsing.py new/cffi-1.13.2/testing/cffi0/test_parsing.py --- old/cffi-1.13.0/testing/cffi0/test_parsing.py 2019-10-15 11:27:46.000000000 +0200 +++ new/cffi-1.13.2/testing/cffi0/test_parsing.py 2019-11-03 15:22:31.000000000 +0100 @@ -324,6 +324,7 @@ assert value == sys.maxsize * 2 - 40 def test__is_constant_globalvar(): + import warnings for input, expected_output in [ ("int a;", False), ("const int a;", True), @@ -341,10 +342,13 @@ ("const int a[5][6];", False), ]: ffi = FFI() - ffi.cdef(input) + with warnings.catch_warnings(record=True) as log: + warnings.simplefilter("always") + ffi.cdef(input) declarations = ffi._parser._declarations assert ('constant a' in declarations) == expected_output assert ('variable a' in declarations) == (not expected_output) + assert len(log) == (1 - expected_output) def test_restrict(): from cffi import model @@ -354,7 +358,7 @@ ("int *a;", False), ]: ffi = FFI() - ffi.cdef(input) + ffi.cdef("extern " + input) tp, quals = ffi._parser._declarations['variable a'] assert bool(quals & model.Q_RESTRICT) == expected_output diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.13.0/testing/cffi0/test_verify.py new/cffi-1.13.2/testing/cffi0/test_verify.py --- old/cffi-1.13.0/testing/cffi0/test_verify.py 2019-10-15 11:27:46.000000000 +0200 +++ new/cffi-1.13.2/testing/cffi0/test_verify.py 2019-11-03 15:22:31.000000000 +0100 @@ -286,7 +286,7 @@ def test_var_signed_integer_types(): ffi = FFI() lst = all_signed_integer_types(ffi) - csource = "\n".join(["%s somevar_%s;" % (tp, tp.replace(' ', '_')) + csource = "\n".join(["static %s somevar_%s;" % (tp, tp.replace(' ', '_')) for tp in lst]) ffi.cdef(csource) lib = ffi.verify(csource) @@ -305,7 +305,7 @@ def test_var_unsigned_integer_types(): ffi = FFI() lst = all_unsigned_integer_types(ffi) - csource = "\n".join(["%s somevar_%s;" % (tp, tp.replace(' ', '_')) + csource = "\n".join(["static %s somevar_%s;" % (tp, tp.replace(' ', '_')) for tp in lst]) ffi.cdef(csource) lib = ffi.verify(csource) @@ -817,8 +817,8 @@ def test_access_variable(): ffi = FFI() - ffi.cdef("int foo(void);\n" - "int somenumber;") + ffi.cdef("static int foo(void);\n" + "static int somenumber;") lib = ffi.verify(""" static int somenumber = 2; static int foo(void) { @@ -835,7 +835,7 @@ def test_access_address_of_variable(): # access the address of 'somenumber': need a trick ffi = FFI() - ffi.cdef("int somenumber; static int *const somenumberptr;") + ffi.cdef("static int somenumber; static int *const somenumberptr;") lib = ffi.verify(""" static int somenumber = 2; #define somenumberptr (&somenumber) @@ -848,7 +848,7 @@ def test_access_array_variable(length=5): ffi = FFI() ffi.cdef("int foo(int);\n" - "int somenumber[%s];" % (length,)) + "static int somenumber[%s];" % (length,)) lib = ffi.verify(""" static int somenumber[] = {2, 2, 3, 4, 5}; static int foo(int i) { @@ -880,7 +880,7 @@ ffi = FFI() ffi.cdef("struct foo { int x; ...; };\n" "int foo(int);\n" - "struct foo stuff;") + "static struct foo stuff;") lib = ffi.verify(""" struct foo { int x, y, z; }; static struct foo stuff = {2, 5, 8}; @@ -904,9 +904,9 @@ def test_access_callback(): ffi = FFI() - ffi.cdef("int (*cb)(int);\n" - "int foo(int);\n" - "void reset_cb(void);") + ffi.cdef("static int (*cb)(int);\n" + "static int foo(int);\n" + "static void reset_cb(void);") lib = ffi.verify(""" static int g(int x) { return x * 7; } static int (*cb)(int); @@ -922,9 +922,9 @@ def test_access_callback_function_typedef(): ffi = FFI() ffi.cdef("typedef int mycallback_t(int);\n" - "mycallback_t *cb;\n" - "int foo(int);\n" - "void reset_cb(void);") + "static mycallback_t *cb;\n" + "static int foo(int);\n" + "static void reset_cb(void);") lib = ffi.verify(""" static int g(int x) { return x * 7; } static int (*cb)(int); @@ -1074,7 +1074,7 @@ def test_autofilled_struct_as_argument_dynamic(): ffi = FFI() ffi.cdef("struct foo_s { long a; ...; };\n" - "int (*foo)(struct foo_s);") + "static int (*foo)(struct foo_s);") lib = ffi.verify(""" struct foo_s { double b; @@ -1083,7 +1083,7 @@ int foo1(struct foo_s s) { return (int)s.a - (int)s.b; } - int (*foo)(struct foo_s s) = &foo1; + static int (*foo)(struct foo_s s) = &foo1; """) e = py.test.raises(NotImplementedError, lib.foo, "?") msg = ("ctype 'struct foo_s' not supported as argument. It is a struct " @@ -1453,7 +1453,7 @@ py.test.skip("_Bool not in MSVC") ffi = FFI() ffi.cdef("struct foo_s { _Bool x; };" - "_Bool foo(_Bool); _Bool (*foop)(_Bool);") + "_Bool foo(_Bool); static _Bool (*foop)(_Bool);") lib = ffi.verify(""" struct foo_s { _Bool x; }; int foo(int arg) { @@ -1462,7 +1462,7 @@ _Bool _foofunc(_Bool x) { return !x; } - _Bool (*foop)(_Bool) = _foofunc; + static _Bool (*foop)(_Bool) = _foofunc; """) p = ffi.new("struct foo_s *") p.x = 1 @@ -1653,7 +1653,7 @@ def test_FILE_stored_explicitly(): ffi = FFI() - ffi.cdef("int myprintf11(const char *, int); FILE *myfile;") + ffi.cdef("int myprintf11(const char *, int); extern FILE *myfile;") lib = ffi.verify(""" #include <stdio.h> FILE *myfile; @@ -1679,19 +1679,19 @@ def test_global_array_with_missing_length(): ffi = FFI() - ffi.cdef("int fooarray[];") + ffi.cdef("extern int fooarray[];") lib = ffi.verify("int fooarray[50];") assert repr(lib.fooarray).startswith("<cdata 'int *'") def test_global_array_with_dotdotdot_length(): ffi = FFI() - ffi.cdef("int fooarray[...];") + ffi.cdef("extern int fooarray[...];") lib = ffi.verify("int fooarray[50];") assert repr(lib.fooarray).startswith("<cdata 'int[50]'") def test_bad_global_array_with_dotdotdot_length(): ffi = FFI() - ffi.cdef("int fooarray[...];") + ffi.cdef("extern int fooarray[...];") py.test.raises(VerificationError, ffi.verify, "char fooarray[23];") def test_struct_containing_struct(): @@ -1812,7 +1812,7 @@ def test_callback_indirection(): ffi = FFI() ffi.cdef(""" - int (*python_callback)(int how_many, int *values); + static int (*python_callback)(int how_many, int *values); int (*const c_callback)(int,...); /* pass this ptr to C routines */ int some_c_function(int(*cb)(int,...)); """) @@ -1946,24 +1946,24 @@ def test_bug_const_char_ptr_array_1(): ffi = FFI() - ffi.cdef("""const char *a[...];""") + ffi.cdef("""extern const char *a[...];""") lib = ffi.verify("""const char *a[5];""") assert repr(ffi.typeof(lib.a)) == "<ctype 'char *[5]'>" def test_bug_const_char_ptr_array_2(): from cffi import FFI # ignore warnings ffi = FFI() - ffi.cdef("""const int a[];""") + ffi.cdef("""extern const int a[];""") lib = ffi.verify("""const int a[5];""") assert repr(ffi.typeof(lib.a)) == "<ctype 'int *'>" def _test_various_calls(force_libffi): cdef_source = """ - int xvalue; - long long ivalue, rvalue; - float fvalue; - double dvalue; - long double Dvalue; + extern int xvalue; + extern long long ivalue, rvalue; + extern float fvalue; + extern double dvalue; + extern long double Dvalue; signed char tf_bb(signed char x, signed char c); unsigned char tf_bB(signed char x, unsigned char c); short tf_bh(signed char x, short c); @@ -2147,7 +2147,7 @@ # exported symbols as well. So we must not export a simple name # like 'foo'! ffi1 = FFI() - ffi1.cdef("int foo_verify_dlopen_flags;") + ffi1.cdef("extern int foo_verify_dlopen_flags;") lib1 = ffi1.verify("int foo_verify_dlopen_flags;", flags=ffi1.RTLD_GLOBAL | ffi1.RTLD_LAZY) @@ -2161,7 +2161,7 @@ def get_second_lib(): # Hack, using modulename makes the test fail ffi2 = FFI() - ffi2.cdef("int foo_verify_dlopen_flags;") + ffi2.cdef("extern int foo_verify_dlopen_flags;") lib2 = ffi2.verify("int foo_verify_dlopen_flags;", flags=ffi2.RTLD_GLOBAL | ffi2.RTLD_LAZY) return lib2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.13.0/testing/cffi1/test_dlopen.py new/cffi-1.13.2/testing/cffi1/test_dlopen.py --- old/cffi-1.13.0/testing/cffi1/test_dlopen.py 2019-10-15 11:27:46.000000000 +0200 +++ new/cffi-1.13.2/testing/cffi1/test_dlopen.py 2019-11-03 15:22:31.000000000 +0100 @@ -6,7 +6,7 @@ def test_simple(): ffi = FFI() - ffi.cdef("int close(int); static const int BB = 42; int somevar;") + ffi.cdef("int close(int); static const int BB = 42; extern int somevar;") target = udir.join('test_simple.py') make_py_source(ffi, 'test_simple', str(target)) assert target.read() == r"""# auto-generated file @@ -196,7 +196,7 @@ def test_global_var(): ffi = FFI() - ffi.cdef("int myglob;") + ffi.cdef("extern int myglob;") target = udir.join('test_global_var.py') make_py_source(ffi, 'test_global_var', str(target)) assert target.read() == r"""# auto-generated file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.13.0/testing/cffi1/test_new_ffi_1.py new/cffi-1.13.2/testing/cffi1/test_new_ffi_1.py --- old/cffi-1.13.0/testing/cffi1/test_new_ffi_1.py 2019-10-15 11:27:46.000000000 +0200 +++ new/cffi-1.13.2/testing/cffi1/test_new_ffi_1.py 2019-11-03 15:22:31.000000000 +0100 @@ -1779,7 +1779,7 @@ def test_import_from_lib(self): ffi2 = cffi.FFI() - ffi2.cdef("int myfunc(int); int myvar;\n#define MYFOO ...\n") + ffi2.cdef("int myfunc(int); extern int myvar;\n#define MYFOO ...\n") outputfilename = recompile(ffi2, "_test_import_from_lib", "int myfunc(int x) { return x + 1; }\n" "int myvar = -5;\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.13.0/testing/cffi1/test_re_python.py new/cffi-1.13.2/testing/cffi1/test_re_python.py --- old/cffi-1.13.0/testing/cffi1/test_re_python.py 2019-10-15 11:27:46.000000000 +0200 +++ new/cffi-1.13.2/testing/cffi1/test_re_python.py 2019-11-03 15:22:31.000000000 +0100 @@ -63,11 +63,11 @@ #define BIGNEG -420000000000L int add42(int); int add43(int, ...); - int globalvar42; + extern int globalvar42; const int globalconst42; const char *const globalconsthello; int no_such_function(int); - int no_such_globalvar; + extern int no_such_globalvar; struct foo_s; typedef struct bar_s { int x; signed char a[]; } bar_t; enum foo_e { AA, BB, CC }; @@ -75,6 +75,7 @@ struct with_union { union { int a; char b; }; }; union with_struct { struct { int a; char b; }; }; struct NVGcolor { union { float rgba[4]; struct { float r,g,b,a; }; }; }; + typedef struct selfref { struct selfref *next; } *selfref_ptr_t; """) ffi.set_source('re_python_pysrc', None) ffi.emit_python_code(str(tmpdir.join('re_python_pysrc.py'))) @@ -254,3 +255,8 @@ assert ffi.offsetof("struct NVGcolor", "g") == FLOAT assert ffi.offsetof("struct NVGcolor", "b") == FLOAT * 2 assert ffi.offsetof("struct NVGcolor", "a") == FLOAT * 3 + +def test_selfref(): + # based on issue #429 + from re_python_pysrc import ffi + ffi.new("selfref_ptr_t") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.13.0/testing/cffi1/test_recompiler.py new/cffi-1.13.2/testing/cffi1/test_recompiler.py --- old/cffi-1.13.0/testing/cffi1/test_recompiler.py 2019-10-15 11:27:46.000000000 +0200 +++ new/cffi-1.13.2/testing/cffi1/test_recompiler.py 2019-11-03 15:22:31.000000000 +0100 @@ -83,7 +83,7 @@ "(FUNCTION 1)(PRIMITIVE 7)(FUNCTION_END 1)(POINTER 0)") def test_type_table_array(): - check_type_table("int a[100];", + check_type_table("extern int a[100];", "(PRIMITIVE 7)(ARRAY 0)(None 100)") def test_type_table_typedef(): @@ -158,7 +158,7 @@ def test_global_var_array(): ffi = FFI() - ffi.cdef("int a[100];") + ffi.cdef("extern int a[100];") lib = verify(ffi, 'test_global_var_array', 'int a[100] = { 9999 };') lib.a[42] = 123456 assert lib.a[42] == 123456 @@ -182,7 +182,7 @@ def test_global_var_int(): ffi = FFI() - ffi.cdef("int a, b, c;") + ffi.cdef("extern int a, b, c;") lib = verify(ffi, 'test_global_var_int', 'int a = 999, b, c;') assert lib.a == 999 lib.a -= 1001 @@ -283,7 +283,7 @@ def test_dir(): ffi = FFI() - ffi.cdef("int ff(int); int aa; static const int my_constant;") + ffi.cdef("int ff(int); extern int aa; static const int my_constant;") lib = verify(ffi, 'test_dir', """ #define my_constant (-45) int aa; @@ -405,7 +405,7 @@ def test_dotdotdot_global_array(): ffi = FFI() - ffi.cdef("int aa[...]; int bb[...];") + ffi.cdef("extern int aa[...]; extern int bb[...];") lib = verify(ffi, 'test_dotdotdot_global_array', "int aa[41]; int bb[12];") assert ffi.sizeof(lib.aa) == 41 * 4 @@ -560,37 +560,37 @@ def test_bad_size_of_global_1(): ffi = FFI() - ffi.cdef("short glob;") + ffi.cdef("extern short glob;") py.test.raises(VerificationError, verify, ffi, "test_bad_size_of_global_1", "long glob;") def test_bad_size_of_global_2(): ffi = FFI() - ffi.cdef("int glob[10];") + ffi.cdef("extern int glob[10];") py.test.raises(VerificationError, verify, ffi, "test_bad_size_of_global_2", "int glob[9];") def test_unspecified_size_of_global_1(): ffi = FFI() - ffi.cdef("int glob[];") + ffi.cdef("extern int glob[];") lib = verify(ffi, "test_unspecified_size_of_global_1", "int glob[10];") assert ffi.typeof(lib.glob) == ffi.typeof("int *") def test_unspecified_size_of_global_2(): ffi = FFI() - ffi.cdef("int glob[][5];") + ffi.cdef("extern int glob[][5];") lib = verify(ffi, "test_unspecified_size_of_global_2", "int glob[10][5];") assert ffi.typeof(lib.glob) == ffi.typeof("int(*)[5]") def test_unspecified_size_of_global_3(): ffi = FFI() - ffi.cdef("int glob[][...];") + ffi.cdef("extern int glob[][...];") lib = verify(ffi, "test_unspecified_size_of_global_3", "int glob[10][5];") assert ffi.typeof(lib.glob) == ffi.typeof("int(*)[5]") def test_unspecified_size_of_global_4(): ffi = FFI() - ffi.cdef("int glob[...][...];") + ffi.cdef("extern int glob[...][...];") lib = verify(ffi, "test_unspecified_size_of_global_4", "int glob[10][5];") assert ffi.typeof(lib.glob) == ffi.typeof("int[10][5]") @@ -813,7 +813,7 @@ def test_address_of_global_var(): ffi = FFI() ffi.cdef(""" - long bottom, bottoms[2]; + extern long bottom, bottoms[2]; long FetchRectBottom(void); long FetchRectBottoms1(void); #define FOOBAR 42 @@ -968,7 +968,7 @@ ffi = FFI() ffi.cdef(""" typedef ... opaque_t; - opaque_t globvar; + extern opaque_t globvar; """) lib = verify(ffi, 'test_variable_of_unknown_size', """ typedef char opaque_t[6]; @@ -1013,7 +1013,7 @@ def test_call_with_incomplete_structs(): ffi = FFI() ffi.cdef("typedef struct {...;} foo_t; " - "foo_t myglob; " + "extern foo_t myglob; " "foo_t increment(foo_t s); " "double getx(foo_t s);") lib = verify(ffi, 'test_call_with_incomplete_structs', """ @@ -1057,7 +1057,7 @@ def test_global_var_array_2(): ffi = FFI() - ffi.cdef("int a[...][...];") + ffi.cdef("extern int a[...][...];") lib = verify(ffi, 'test_global_var_array_2', 'int a[10][8];') lib.a[9][7] = 123456 assert lib.a[9][7] == 123456 @@ -1070,7 +1070,7 @@ def test_global_var_array_3(): ffi = FFI() - ffi.cdef("int a[][...];") + ffi.cdef("extern int a[][...];") lib = verify(ffi, 'test_global_var_array_3', 'int a[10][8];') lib.a[9][7] = 123456 assert lib.a[9][7] == 123456 @@ -1081,7 +1081,7 @@ def test_global_var_array_4(): ffi = FFI() - ffi.cdef("int a[10][...];") + ffi.cdef("extern int a[10][...];") lib = verify(ffi, 'test_global_var_array_4', 'int a[10][8];') lib.a[9][7] = 123456 assert lib.a[9][7] == 123456 @@ -1204,7 +1204,7 @@ def test_import_from_lib(): ffi = FFI() - ffi.cdef("int mybar(int); int myvar;\n#define MYFOO ...") + ffi.cdef("int mybar(int); static int myvar;\n#define MYFOO ...") lib = verify(ffi, 'test_import_from_lib', "#define MYFOO 42\n" "static int mybar(int x) { return x + 1; }\n" @@ -1220,7 +1220,7 @@ def test_macro_var_callback(): ffi = FFI() - ffi.cdef("int my_value; int *(*get_my_value)(void);") + ffi.cdef("extern int my_value; extern int *(*get_my_value)(void);") lib = verify(ffi, 'test_macro_var_callback', "int *(*get_my_value)(void);\n" "#define my_value (*get_my_value())") @@ -1335,7 +1335,7 @@ def test_const_function_type_args(): ffi = FFI() - ffi.cdef("""int (*foobar)(const int a, const int *b, const int c[]);""") + ffi.cdef("""extern int(*foobar)(const int a,const int*b,const int c[]);""") lib = verify(ffi, 'test_const_function_type_args', """ int (*foobar)(const int a, const int *b, const int c[]); """) @@ -1625,7 +1625,7 @@ def test_extern_python_bogus_name(): ffi = FFI() - ffi.cdef("int abc;") + ffi.cdef("extern int abc;") lib = verify(ffi, 'test_extern_python_bogus_name', "int abc;") def fn(): pass @@ -1786,8 +1786,8 @@ ffi.cdef(""" extern "Python" int __stdcall foo(int); extern "Python" int WINAPI bar(int); - int (__stdcall * mycb1)(int); - int indirect_call(int); + static int (__stdcall * mycb1)(int); + static int indirect_call(int); """) lib = verify(ffi, 'test_extern_python_stdcall', """ #ifndef _MSC_VER @@ -1855,7 +1855,7 @@ def test_introspect_global_var(): ffi = FFI() - ffi.cdef("float g1;") + ffi.cdef("extern float g1;") lib = verify(ffi, 'test_introspect_global_var', """ float g1; """) @@ -1866,7 +1866,7 @@ def test_introspect_global_var_array(): ffi = FFI() - ffi.cdef("float g1[100];") + ffi.cdef("extern float g1[100];") lib = verify(ffi, 'test_introspect_global_var_array', """ float g1[100]; """) @@ -2089,7 +2089,7 @@ ffi = FFI() ffi.cdef(""" typedef int foo_t[...], bar_t[...]; - int gv[...]; + extern int gv[...]; typedef int mat_t[...][...]; typedef int vmat_t[][...]; """) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.13.0/testing/cffi1/test_verify1.py new/cffi-1.13.2/testing/cffi1/test_verify1.py --- old/cffi-1.13.0/testing/cffi1/test_verify1.py 2019-10-15 11:27:46.000000000 +0200 +++ new/cffi-1.13.2/testing/cffi1/test_verify1.py 2019-11-03 15:22:31.000000000 +0100 @@ -267,7 +267,7 @@ def test_var_signed_integer_types(): ffi = FFI() lst = all_signed_integer_types(ffi) - csource = "\n".join(["%s somevar_%s;" % (tp, tp.replace(' ', '_')) + csource = "\n".join(["static %s somevar_%s;" % (tp, tp.replace(' ', '_')) for tp in lst]) ffi.cdef(csource) lib = ffi.verify(csource) @@ -286,7 +286,7 @@ def test_var_unsigned_integer_types(): ffi = FFI() lst = all_unsigned_integer_types(ffi) - csource = "\n".join(["%s somevar_%s;" % (tp, tp.replace(' ', '_')) + csource = "\n".join(["static %s somevar_%s;" % (tp, tp.replace(' ', '_')) for tp in lst]) ffi.cdef(csource) lib = ffi.verify(csource) @@ -790,8 +790,8 @@ def test_access_variable(): ffi = FFI() - ffi.cdef("int foo(void);\n" - "int somenumber;") + ffi.cdef("static int foo(void);\n" + "static int somenumber;") lib = ffi.verify(""" static int somenumber = 2; static int foo(void) { @@ -808,7 +808,7 @@ def test_access_address_of_variable(): # access the address of 'somenumber': need a trick ffi = FFI() - ffi.cdef("int somenumber; static int *const somenumberptr;") + ffi.cdef("static int somenumber; static int *const somenumberptr;") lib = ffi.verify(""" static int somenumber = 2; #define somenumberptr (&somenumber) @@ -820,8 +820,8 @@ def test_access_array_variable(length=5): ffi = FFI() - ffi.cdef("int foo(int);\n" - "int somenumber[%s];" % (length,)) + ffi.cdef("static int foo(int);\n" + "static int somenumber[%s];" % (length,)) lib = ffi.verify(""" static int somenumber[] = {2, 2, 3, 4, 5}; static int foo(int i) { @@ -852,8 +852,8 @@ def test_access_struct_variable(): ffi = FFI() ffi.cdef("struct foo { int x; ...; };\n" - "int foo(int);\n" - "struct foo stuff;") + "static int foo(int);\n" + "static struct foo stuff;") lib = ffi.verify(""" struct foo { int x, y, z; }; static struct foo stuff = {2, 5, 8}; @@ -877,9 +877,9 @@ def test_access_callback(): ffi = FFI() - ffi.cdef("int (*cb)(int);\n" - "int foo(int);\n" - "void reset_cb(void);") + ffi.cdef("static int (*cb)(int);\n" + "static int foo(int);\n" + "static void reset_cb(void);") lib = ffi.verify(""" static int g(int x) { return x * 7; } static int (*cb)(int); @@ -895,9 +895,9 @@ def test_access_callback_function_typedef(): ffi = FFI() ffi.cdef("typedef int mycallback_t(int);\n" - "mycallback_t *cb;\n" - "int foo(int);\n" - "void reset_cb(void);") + "static mycallback_t *cb;\n" + "static int foo(int);\n" + "static void reset_cb(void);") lib = ffi.verify(""" static int g(int x) { return x * 7; } static int (*cb)(int); @@ -1038,7 +1038,7 @@ def test_autofilled_struct_as_argument_dynamic(): ffi = FFI() ffi.cdef("struct foo_s { long a; ...; };\n" - "int (*foo)(struct foo_s);") + "static int (*foo)(struct foo_s);") lib = ffi.verify(""" struct foo_s { double b; @@ -1047,7 +1047,7 @@ int foo1(struct foo_s s) { return (int)s.a - (int)s.b; } - int (*foo)(struct foo_s s) = &foo1; + static int (*foo)(struct foo_s s) = &foo1; """) e = py.test.raises(NotImplementedError, lib.foo, "?") msg = ("ctype 'struct foo_s' not supported as argument. It is a struct " @@ -1423,7 +1423,7 @@ py.test.skip("_Bool not in MSVC") ffi = FFI() ffi.cdef("struct foo_s { _Bool x; };" - "_Bool foo(_Bool); _Bool (*foop)(_Bool);") + "_Bool foo(_Bool); static _Bool (*foop)(_Bool);") lib = ffi.verify(""" struct foo_s { _Bool x; }; int foo(int arg) { @@ -1432,7 +1432,7 @@ _Bool _foofunc(_Bool x) { return !x; } - _Bool (*foop)(_Bool) = _foofunc; + static _Bool (*foop)(_Bool) = _foofunc; """) p = ffi.new("struct foo_s *") p.x = 1 @@ -1617,7 +1617,7 @@ def test_FILE_stored_explicitly(): ffi = FFI() - ffi.cdef("int myprintf11(const char *, int); FILE *myfile;") + ffi.cdef("int myprintf11(const char *, int); extern FILE *myfile;") lib = ffi.verify(""" #include <stdio.h> FILE *myfile; @@ -1643,13 +1643,13 @@ def test_global_array_with_missing_length(): ffi = FFI() - ffi.cdef("int fooarray[];") + ffi.cdef("extern int fooarray[];") lib = ffi.verify("int fooarray[50];") assert repr(lib.fooarray).startswith("<cdata 'int *'") def test_global_array_with_dotdotdot_length(): ffi = FFI() - ffi.cdef("int fooarray[...];") + ffi.cdef("extern int fooarray[...];") lib = ffi.verify("int fooarray[50];") assert repr(lib.fooarray).startswith("<cdata 'int[50]'") @@ -1657,7 +1657,7 @@ py.test.xfail("was detected only because 23 bytes cannot be divided by 4; " "redo more generally") ffi = FFI() - ffi.cdef("int fooarray[...];") + ffi.cdef("extern int fooarray[...];") py.test.raises(VerificationError, ffi.verify, "char fooarray[23];") def test_struct_containing_struct(): @@ -1778,7 +1778,7 @@ def test_callback_indirection(): ffi = FFI() ffi.cdef(""" - int (*python_callback)(int how_many, int *values); + static int (*python_callback)(int how_many, int *values); int (*const c_callback)(int,...); /* pass this ptr to C routines */ int some_c_function(int(*cb)(int,...)); """) @@ -1912,23 +1912,23 @@ def test_bug_const_char_ptr_array_1(): ffi = FFI() - ffi.cdef("""const char *a[...];""") + ffi.cdef("""extern const char *a[...];""") lib = ffi.verify("""const char *a[5];""") assert repr(ffi.typeof(lib.a)) == "<ctype 'char *[5]'>" def test_bug_const_char_ptr_array_2(): ffi = FFI() - ffi.cdef("""const int a[];""") + ffi.cdef("""extern const int a[];""") lib = ffi.verify("""const int a[5];""") assert repr(ffi.typeof(lib.a)) == "<ctype 'int *'>" def _test_various_calls(force_libffi): cdef_source = """ - int xvalue; - long long ivalue, rvalue; - float fvalue; - double dvalue; - long double Dvalue; + extern int xvalue; + extern long long ivalue, rvalue; + extern float fvalue; + extern double dvalue; + extern long double Dvalue; signed char tf_bb(signed char x, signed char c); unsigned char tf_bB(signed char x, unsigned char c); short tf_bh(signed char x, short c); @@ -2111,7 +2111,7 @@ old = sys.getdlopenflags() try: ffi1 = FFI() - ffi1.cdef("int foo_verify_dlopen_flags_1;") + ffi1.cdef("extern int foo_verify_dlopen_flags_1;") sys.setdlopenflags(ffi1.RTLD_GLOBAL | ffi1.RTLD_NOW) lib1 = ffi1.verify("int foo_verify_dlopen_flags_1;") finally: @@ -2252,7 +2252,7 @@ def test_macro_var(): ffi = FFI() - ffi.cdef("int myarray[50], my_value;") + ffi.cdef("extern int myarray[50], my_value;") lib = ffi.verify(""" int myarray[50]; int *get_my_value(void) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.13.0/testing/embedding/add1.py new/cffi-1.13.2/testing/embedding/add1.py --- old/cffi-1.13.0/testing/embedding/add1.py 2019-10-15 11:27:46.000000000 +0200 +++ new/cffi-1.13.2/testing/embedding/add1.py 2019-11-03 15:22:31.000000000 +0100 @@ -11,7 +11,11 @@ sys.stdout.write("preparing") for i in range(3): sys.stdout.flush() - time.sleep(0.2) + # Windows: sometimes time.sleep() doesn't sleep at all. + # This appears to occur on recent versions of python only. + t_end = time.time() + 0.19 + while time.time() < t_end: + time.sleep(0.2) sys.stdout.write(".") sys.stdout.write("\n") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.13.0/testing/embedding/add_recursive.py new/cffi-1.13.2/testing/embedding/add_recursive.py --- old/cffi-1.13.0/testing/embedding/add_recursive.py 2019-10-15 11:27:46.000000000 +0200 +++ new/cffi-1.13.2/testing/embedding/add_recursive.py 2019-11-03 15:22:31.000000000 +0100 @@ -3,7 +3,7 @@ ffi = cffi.FFI() ffi.embedding_api(""" - int (*my_callback)(int); + extern int (*my_callback)(int); int add_rec(int, int); """) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cffi-1.13.0/testing/embedding/test_thread.py new/cffi-1.13.2/testing/embedding/test_thread.py --- old/cffi-1.13.0/testing/embedding/test_thread.py 2019-10-15 11:27:46.000000000 +0200 +++ new/cffi-1.13.2/testing/embedding/test_thread.py 2019-11-03 15:22:31.000000000 +0100 @@ -21,17 +21,21 @@ add1_cffi = self.prepare_module('add1') add2_cffi = self.prepare_module('add2') self.compile('thread2-test', [add1_cffi, add2_cffi], threads=True) - output = self.execute('thread2-test') - output = self._take_out(output, "preparing") - output = self._take_out(output, ".") - output = self._take_out(output, ".") - # at least the 3rd dot should be after everything from ADD2 - assert output == ("starting\n" - "prepADD2\n" - "adding 1000 and 200 and 30\n" - ".\n" - "adding 40 and 2\n" - "done\n") + for i in range(3): + output = self.execute('thread2-test') + print('='*79) + print(output) + print('='*79) + output = self._take_out(output, "preparing") + output = self._take_out(output, ".") + output = self._take_out(output, ".") + # at least the 3rd dot should be after everything from ADD2 + assert output == ("starting\n" + "prepADD2\n" + "adding 1000 and 200 and 30\n" + ".\n" + "adding 40 and 2\n" + "done\n") def test_alt_issue(self): add1_cffi = self.prepare_module('add1')