Author: mattip <matti.pi...@gmail.com> Branch: pypyw Changeset: r77462:ec69c4d93cb2 Date: 2015-05-21 21:53 +0300 http://bitbucket.org/pypy/pypy/changeset/ec69c4d93cb2/
Log: merge default into branch diff --git a/lib_pypy/cffi.egg-info/PKG-INFO b/lib_pypy/cffi.egg-info/PKG-INFO --- a/lib_pypy/cffi.egg-info/PKG-INFO +++ b/lib_pypy/cffi.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: cffi -Version: 1.0.0 +Version: 1.0.1 Summary: Foreign Function Interface for Python calling C code. Home-page: http://cffi.readthedocs.org Author: Armin Rigo, Maciej Fijalkowski 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,8 +4,8 @@ from .api import FFI, CDefError, FFIError from .ffiplatform import VerificationError, VerificationMissing -__version__ = "1.0.0" -__version_info__ = (1, 0, 0) +__version__ = "1.0.1" +__version_info__ = (1, 0, 1) # 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 --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 @@ -109,6 +109,11 @@ if override: for cache in self._function_caches: cache.clear() + finishlist = self._parser._recomplete + if finishlist: + self._parser._recomplete = [] + for tp in finishlist: + tp.finish_backend_type(self, finishlist) def dlopen(self, name, flags=0): """Load and return a dynamic library identified by 'name'. diff --git a/lib_pypy/cffi/cparser.py b/lib_pypy/cffi/cparser.py --- a/lib_pypy/cffi/cparser.py +++ b/lib_pypy/cffi/cparser.py @@ -101,6 +101,7 @@ self._override = False self._packed = False self._int_constants = {} + self._recomplete = [] def _parse(self, csource): csource, macros = _preprocess(csource) @@ -555,6 +556,9 @@ raise NotImplementedError("%s: using both bitfields and '...;'" % (tp,)) tp.packed = self._packed + if tp.completed: # must be re-completed: it is not opaque any more + tp.completed = 0 + self._recomplete.append(tp) return tp def _make_partial(self, tp, nested): @@ -604,19 +608,21 @@ def _build_enum_type(self, explicit_name, decls): if decls is not None: - enumerators1 = [enum.name for enum in decls.enumerators] - enumerators = [s for s in enumerators1 - if not _r_enum_dotdotdot.match(s)] - partial = len(enumerators) < len(enumerators1) - enumerators = tuple(enumerators) + partial = False + enumerators = [] enumvalues = [] nextenumvalue = 0 - for enum in decls.enumerators[:len(enumerators)]: + for enum in decls.enumerators: + if _r_enum_dotdotdot.match(enum.name): + partial = True + continue if enum.value is not None: nextenumvalue = self._parse_constant(enum.value) + enumerators.append(enum.name) enumvalues.append(nextenumvalue) self._add_constants(enum.name, nextenumvalue) nextenumvalue += 1 + enumerators = tuple(enumerators) enumvalues = tuple(enumvalues) tp = model.EnumType(explicit_name, enumerators, enumvalues) tp.partial = partial diff --git a/lib_pypy/cffi/model.py b/lib_pypy/cffi/model.py --- a/lib_pypy/cffi/model.py +++ b/lib_pypy/cffi/model.py @@ -293,7 +293,7 @@ class StructOrUnion(StructOrUnionOrEnum): fixedlayout = None - completed = False + completed = 0 partial = False packed = False @@ -351,12 +351,13 @@ "for '%s'" % (self.name,)) return BType = ffi._cached_btypes[self] - if self.fldtypes is None: - return # not completing it: it's an opaque struct # self.completed = 1 # - if self.fixedlayout is None: + if self.fldtypes is None: + pass # not completing it: it's an opaque struct + # + elif self.fixedlayout is None: fldtypes = [tp.get_cached_btype(ffi, finishlist) for tp in self.fldtypes] lst = list(zip(self.fldnames, fldtypes, self.fldbitsize)) diff --git a/lib_pypy/cffi/setuptools_ext.py b/lib_pypy/cffi/setuptools_ext.py --- a/lib_pypy/cffi/setuptools_ext.py +++ b/lib_pypy/cffi/setuptools_ext.py @@ -76,7 +76,7 @@ from cffi import recompiler allsources = ['$PLACEHOLDER'] - allsources.extend(kwds.get('sources', [])) + allsources.extend(kwds.pop('sources', [])) ext = Extension(name=module_name, sources=allsources, **kwds) def make_mod(tmpdir): diff --git a/pypy/doc/sprint-reports.rst b/pypy/doc/sprint-reports.rst --- a/pypy/doc/sprint-reports.rst +++ b/pypy/doc/sprint-reports.rst @@ -1,4 +1,4 @@ -Sprint reports from PyPy sprints 2003-2006 +Sprint reports from PyPy sprints 2003-2010 ========================================== Here are links to sprint reports from various sprints in the PyPy project, diff --git a/pypy/module/_cffi_backend/__init__.py b/pypy/module/_cffi_backend/__init__.py --- a/pypy/module/_cffi_backend/__init__.py +++ b/pypy/module/_cffi_backend/__init__.py @@ -2,7 +2,7 @@ from pypy.interpreter.mixedmodule import MixedModule from rpython.rlib import rdynload -VERSION = "1.0.0" +VERSION = "1.0.1" class Module(MixedModule): diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py b/pypy/module/_cffi_backend/test/_backend_test_c.py --- a/pypy/module/_cffi_backend/test/_backend_test_c.py +++ b/pypy/module/_cffi_backend/test/_backend_test_c.py @@ -3335,4 +3335,4 @@ def test_version(): # this test is here mostly for PyPy - assert __version__ == "1.0.0" + assert __version__ == "1.0.1" diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py @@ -1704,3 +1704,13 @@ assert lib.DOT_HEX == 0x100 assert lib.DOT_HEX2 == 0x10 assert lib.DOT_UL == 1000 + + def test_opaque_struct_becomes_nonopaque(self): + # Issue #193: if we use a struct between the first cdef() where it is + # declared and another cdef() where its fields are defined, then the + # definition was ignored. + ffi = FFI(backend=self.Backend()) + ffi.cdef("struct foo_s;") + py.test.raises(TypeError, ffi.new, "struct foo_s *") + ffi.cdef("struct foo_s { int x; };") + ffi.new("struct foo_s *") diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_verify.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_verify.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_verify.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_verify.py @@ -765,6 +765,11 @@ assert ffi.string(ffi.cast('enum ee2', -1239)) == 'EE4' assert ffi.string(ffi.cast('enum ee2', -1238)) == 'EE5' +def test_nonfull_enum_bug3(): + ffi = FFI() + ffi.cdef("enum ee2 { EE4=..., EE5=... };") + ffi.cdef("enum ee6 { EE7=10, EE8=..., EE9=... };") + def test_get_set_errno(): ffi = FFI() ffi.cdef("int foo(int);") diff --git a/rpython/jit/metainterp/optimizeopt/heap.py b/rpython/jit/metainterp/optimizeopt/heap.py --- a/rpython/jit/metainterp/optimizeopt/heap.py +++ b/rpython/jit/metainterp/optimizeopt/heap.py @@ -171,7 +171,7 @@ elif op.result is not None: shortboxes.add_potential(op) -class BogusPureField(JitException): +class BogusImmutableField(JitException): pass @@ -504,7 +504,7 @@ op.getdescr()): os.write(2, '[bogus _immutable_field_ declaration: %s]\n' % (op.getdescr().repr_of_descr())) - raise BogusPureField + raise BogusImmutableField # cf = self.field_cache(op.getdescr()) cf.do_setfield(self, op) @@ -557,7 +557,7 @@ op.getdescr()): os.write(2, '[bogus immutable array declaration: %s]\n' % (op.getdescr().repr_of_descr())) - raise BogusPureField + raise BogusImmutableField # indexvalue = self.getvalue(op.getarg(1)) if indexvalue.is_constant(): diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py --- a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py +++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py @@ -4856,7 +4856,7 @@ self.optimize_loop(ops, expected) def test_complains_getfieldpure_setfield(self): - from rpython.jit.metainterp.optimizeopt.heap import BogusPureField + from rpython.jit.metainterp.optimizeopt.heap import BogusImmutableField ops = """ [p3] p1 = escape() @@ -4864,7 +4864,7 @@ setfield_gc(p1, p3, descr=nextdescr) jump(p3) """ - self.raises(BogusPureField, self.optimize_loop, ops, "crash!") + self.raises(BogusImmutableField, self.optimize_loop, ops, "crash!") def test_dont_complains_different_field(self): ops = """ diff --git a/rpython/rlib/rdynload.py b/rpython/rlib/rdynload.py --- a/rpython/rlib/rdynload.py +++ b/rpython/rlib/rdynload.py @@ -152,9 +152,9 @@ def dlclose(handle): res = rwin32.FreeLibrary(handle) if res: - return -1 + return 0 # success else: - return 0 + return -1 # error def dlsym(handle, name): res = rwin32.GetProcAddress(handle, name) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit