Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r72417:08d164cb3d40 Date: 2014-07-11 12:24 +0200 http://bitbucket.org/pypy/pypy/changeset/08d164cb3d40/
Log: Oops, I upgraded the _cffi_backend to version 0.8.6 but forgot that the lib_pypy/cffi directory was still checking for 0.8.2. diff --git a/lib_pypy/cffi/__init__.py b/lib_pypy/cffi/__init__.py --- a/lib_pypy/cffi/__init__.py +++ b/lib_pypy/cffi/__init__.py @@ -4,5 +4,5 @@ from .api import FFI, CDefError, FFIError from .ffiplatform import VerificationError, VerificationMissing -__version__ = "0.8.2" -__version_info__ = (0, 8, 2) +__version__ = "0.8.6" +__version_info__ = (0, 8, 6) diff --git a/lib_pypy/cffi/api.py b/lib_pypy/cffi/api.py --- a/lib_pypy/cffi/api.py +++ b/lib_pypy/cffi/api.py @@ -55,8 +55,7 @@ # _cffi_backend.so compiled. import _cffi_backend as backend from . import __version__ - assert (backend.__version__ == __version__ or - backend.__version__ == __version__[:3]) + assert backend.__version__ == __version__ # (If you insist you can also try to pass the option # 'backend=backend_ctypes.CTypesBackend()', but don't # rely on it! It's probably not going to work well.) diff --git a/lib_pypy/cffi/vengine_gen.py b/lib_pypy/cffi/vengine_gen.py --- a/lib_pypy/cffi/vengine_gen.py +++ b/lib_pypy/cffi/vengine_gen.py @@ -435,14 +435,14 @@ enumerator, enumerator, enumvalue)) prnt(' char buf[64];') prnt(' if ((%s) < 0)' % enumerator) - prnt(' snprintf(buf, 63, "%%ld", (long)(%s));' % enumerator) + prnt(' sprintf(buf, "%%ld", (long)(%s));' % enumerator) prnt(' else') - prnt(' snprintf(buf, 63, "%%lu", (unsigned long)(%s));' % + prnt(' sprintf(buf, "%%lu", (unsigned long)(%s));' % enumerator) - prnt(' snprintf(out_error, 255,' + prnt(' sprintf(out_error,' ' "%s has the real value %s, not %s",') prnt(' "%s", buf, "%d");' % ( - enumerator, enumvalue)) + enumerator[:100], enumvalue)) prnt(' return -1;') prnt(' }') prnt(' return 0;') diff --git a/pypy/module/test_lib_pypy/cffi_tests/test_function.py b/pypy/module/test_lib_pypy/cffi_tests/test_function.py --- a/pypy/module/test_lib_pypy/cffi_tests/test_function.py +++ b/pypy/module/test_lib_pypy/cffi_tests/test_function.py @@ -403,3 +403,18 @@ if wr() is not None: import gc; gc.collect() assert wr() is None # 'data' does not leak + + def test_windows_stdcall(self): + if sys.platform != 'win32': + py.test.skip("Windows-only test") + if self.Backend is CTypesBackend: + py.test.skip("not with the ctypes backend") + ffi = FFI(backend=self.Backend()) + ffi.cdef(""" + BOOL QueryPerformanceFrequency(LONGLONG *lpFrequency); + """) + m = ffi.dlopen("Kernel32.dll") + p_freq = ffi.new("LONGLONG *") + res = m.QueryPerformanceFrequency(p_freq) + assert res != 0 + assert p_freq[0] != 0 diff --git a/pypy/module/test_lib_pypy/cffi_tests/test_version.py b/pypy/module/test_lib_pypy/cffi_tests/test_version.py --- a/pypy/module/test_lib_pypy/cffi_tests/test_version.py +++ b/pypy/module/test_lib_pypy/cffi_tests/test_version.py @@ -6,18 +6,20 @@ if '_cffi_backend' in sys.builtin_module_names: py.test.skip("this is embedded version") -BACKEND_VERSIONS = { - '0.4.2': '0.4', # did not change - '0.7.1': '0.7', # did not change - '0.7.2': '0.7', # did not change - '0.8.1': '0.8', # did not change (essentially) - } +#BACKEND_VERSIONS = { +# '0.4.2': '0.4', # did not change +# '0.7.1': '0.7', # did not change +# '0.7.2': '0.7', # did not change +# '0.8.1': '0.8', # did not change (essentially) +# '0.8.4': '0.8.3', # did not change +# } def test_version(): v = cffi.__version__ version_info = '.'.join(str(i) for i in cffi.__version_info__) assert v == version_info - assert BACKEND_VERSIONS.get(v, v) == _cffi_backend.__version__ + #v = BACKEND_VERSIONS.get(v, v) + assert v == _cffi_backend.__version__ def test_doc_version(): parent = os.path.dirname(os.path.dirname(__file__)) @@ -48,5 +50,5 @@ v = cffi.__version__ p = os.path.join(parent, 'c', 'test_c.py') content = open(p).read() - assert (('assert __version__ == "%s"' % BACKEND_VERSIONS.get(v, v)) - in content) + #v = BACKEND_VERSIONS.get(v, v) + assert (('assert __version__ == "%s"' % v) in content) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit