Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r1013:3bb5d49c0c00 Date: 2012-10-28 09:42 +0100 http://bitbucket.org/cffi/cffi/changeset/3bb5d49c0c00/
Log: Allow '[...]' when declaring a global array, and interpret it like '[]'. diff --git a/cffi/cparser.py b/cffi/cparser.py --- a/cffi/cparser.py +++ b/cffi/cparser.py @@ -162,7 +162,7 @@ decl) # if decl.name: - tp = self._get_type(node) + tp = self._get_type(node, partial_length_ok=True) if self._is_constant_declaration(node): self._declare('constant ' + decl.name, tp) else: diff --git a/testing/test_verify.py b/testing/test_verify.py --- a/testing/test_verify.py +++ b/testing/test_verify.py @@ -1275,3 +1275,15 @@ result = posix.read(fdr, 256) posix.close(fdr) assert result == b"Xhello, 42!\n" + +def test_global_array_with_missing_length(): + ffi = FFI() + ffi.cdef("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[...];") + lib = ffi.verify("int fooarray[50];") + assert repr(lib.fooarray).startswith("<cdata 'int *'") _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit