Author: Armin Rigo <ar...@tunes.org> Branch: qualtypes Changeset: r2286:4ef1d72e9b05 Date: 2015-09-30 12:00 +0200 http://bitbucket.org/cffi/cffi/changeset/4ef1d72e9b05/
Log: fixes diff --git a/cffi/recompiler.py b/cffi/recompiler.py --- a/cffi/recompiler.py +++ b/cffi/recompiler.py @@ -203,8 +203,7 @@ def _generate(self, step_name): lst = self.ffi._parser._declarations.items() - lst.sort() - for name, (tp, quals) in lst: + for name, (tp, quals) in sorted(lst): kind, realname = name.split(' ', 1) try: method = getattr(self, '_generate_cpy_%s_%s' % (kind, diff --git a/testing/cffi1/test_recompiler.py b/testing/cffi1/test_recompiler.py --- a/testing/cffi1/test_recompiler.py +++ b/testing/cffi1/test_recompiler.py @@ -1208,7 +1208,7 @@ py.test.skip("'__restrict__' probably not recognized") ffi = FFI() ffi.cdef("""struct foo_s { void * restrict b; };""") - lib = verify(ffi, 'test_const_fields', """ + lib = verify(ffi, 'test_restrict_fields', """ struct foo_s { void * __restrict__ b; };""") foo_s = ffi.typeof("struct foo_s") assert foo_s.fields[0][0] == 'b' @@ -1270,3 +1270,13 @@ """) assert lib.myfoo.x == 40 assert lib.myfoo.y == 2 + +def test_const_via_typedef(): + ffi = FFI() + ffi.cdef("""typedef const int const_t; const_t aaa;""") + lib = verify(ffi, 'test_const_via_typedef', """ + typedef const int const_t; + #define aaa 42 + """) + assert lib.aaa == 42 + py.test.raises(AttributeError, "lib.aaa = 43") _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit