[pypy-commit] cffi cffi-1.0: Deprecate the logic to build types directly from the cffi/ pure python package

arigo noreply at buildbot.pypy.org
Sat Apr 18 11:37:48 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: cffi-1.0
Changeset: r1745:2b08ac02f836
Date: 2015-04-18 11:30 +0200
http://bitbucket.org/cffi/cffi/changeset/2b08ac02f836/

Log:	Deprecate the logic to build types directly from the cffi/ pure
	python package

diff --git a/cffi/api.py b/cffi/api.py
--- a/cffi/api.py
+++ b/cffi/api.py
@@ -2,6 +2,9 @@
 from .lock import allocate_lock
 import _cffi1_backend
 
+class DeprecatedError(Exception):
+    pass
+
 try:
     callable
 except NameError:
@@ -70,9 +73,9 @@
             if name.startswith('RTLD_'):
                 setattr(self, name, getattr(backend, name))
         #
-        with self._lock:
-            self.BVoidP = self._get_cached_btype(model.voidp_type)
-            self.BCharA = self._get_cached_btype(model.char_array_type)
+        #with self._lock:
+        #    self.BVoidP = self._get_cached_btype(model.voidp_type)
+        #    self.BCharA = self._get_cached_btype(model.char_array_type)
 
     def cdef(self, csource, override=False, packed=False):
         """Parse the given C source.  This registers all declared functions,
@@ -314,16 +317,7 @@
             return gc_weakrefs.build(cdata, destructor)
 
     def _get_cached_btype(self, type):
-        assert self._lock.acquire(False) is False
-        # call me with the lock!
-        try:
-            BType = self._cached_btypes[type]
-        except KeyError:
-            finishlist = []
-            BType = type.get_cached_btype(self, finishlist)
-            for type in finishlist:
-                type.finish_backend_type(self, finishlist)
-        return BType
+        raise DeprecatedError
 
     def verify(self, source='', tmpdir=None, **kwargs):
         """Verify that the current ffi signatures compile on this
diff --git a/new/test_dlopen.py b/new/test_dlopen.py
--- a/new/test_dlopen.py
+++ b/new/test_dlopen.py
@@ -1,8 +1,10 @@
+import py
 from cffi1 import FFI
 import math
 
 
 def test_math_sin():
+    py.test.skip("XXX redo!")
     ffi = FFI()
     ffi.cdef("double sin(double);")
     m = ffi.dlopen('m')


More information about the pypy-commit mailing list