[pypy-commit] pypy cffi-1.0: bug fixes

arigo noreply at buildbot.pypy.org
Sun May 17 21:35:09 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: cffi-1.0
Changeset: r77368:f676edbce1c0
Date: 2015-05-17 21:35 +0200
http://bitbucket.org/pypy/pypy/changeset/f676edbce1c0/

Log:	bug fixes

diff --git a/pypy/module/_cffi_backend/cdlopen.py b/pypy/module/_cffi_backend/cdlopen.py
--- a/pypy/module/_cffi_backend/cdlopen.py
+++ b/pypy/module/_cffi_backend/cdlopen.py
@@ -33,10 +33,10 @@
     def cdlopen_fetch(self, name):
         try:
             cdata = dlsym(self.libhandle, name)
-        except DLOpenError, e:
+        except KeyError:
             raise oefmt(self.ffi.w_FFIError,
-                        "symbol '%s' not found in library '%s': %s",
-                        name, self.libname, e.msg)
+                        "symbol '%s' not found in library '%s'",
+                        name, self.libname)
         return rffi.cast(rffi.CCHARP, cdata)
 
     def cdlopen_close(self):
diff --git a/pypy/module/_cffi_backend/test/test_re_python.py b/pypy/module/_cffi_backend/test/test_re_python.py
--- a/pypy/module/_cffi_backend/test/test_re_python.py
+++ b/pypy/module/_cffi_backend/test/test_re_python.py
@@ -47,6 +47,8 @@
         #define BIGNEG -420000000000L
         int add42(int);
         int globalvar42;
+        int no_such_function(int);
+        int no_such_globalvar;
         struct foo_s;
         typedef struct bar_s { int x; signed char a[]; } bar_t;
         enum foo_e { AA, BB, CC };
@@ -160,7 +162,7 @@
 
     def test_no_such_function_or_global_var(self):
         from re_python_pysrc import ffi
-        lib = ffi.dlopen(extmod)
+        lib = ffi.dlopen(self.extmod)
         e = raises(ffi.error, getattr, lib, 'no_such_function')
         assert str(e.value).startswith(
             "symbol 'no_such_function' not found in library '")


More information about the pypy-commit mailing list