[pypy-commit] pypy cffi-1.0: ffi.error

arigo noreply at buildbot.pypy.org
Sat May 2 22:48:15 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: cffi-1.0
Changeset: r76994:31525da2d230
Date: 2015-05-02 22:47 +0200
http://bitbucket.org/pypy/pypy/changeset/31525da2d230/

Log:	ffi.error

diff --git a/pypy/module/_cffi_backend/ffi_obj.py b/pypy/module/_cffi_backend/ffi_obj.py
--- a/pypy/module/_cffi_backend/ffi_obj.py
+++ b/pypy/module/_cffi_backend/ffi_obj.py
@@ -1,3 +1,4 @@
+from pypy.interpreter.error import oefmt
 from pypy.interpreter.baseobjspace import W_Root
 from pypy.interpreter.typedef import TypeDef, GetSetProperty
 from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault
@@ -26,6 +27,8 @@
             self.cached_types = [None] * parse_c_type.get_num_types(src_ctx)
         else:
             self.cached_types = None
+        w_ffitype = space.gettypefor(W_FFIObject)
+        self.w_FFIError = w_ffitype.getdictvalue(space, 'error')
 
     @rgc.must_be_light_finalizer
     def __del__(self):
@@ -185,3 +188,5 @@
     w_NULL = ctvoidp.cast(space.wrap(0))
     w_ffitype = space.gettypefor(W_FFIObject)
     w_ffitype.dict_w['NULL'] = w_NULL
+    w_ffitype.dict_w['error'] = space.appexec([], """():
+        return type('error', (Exception,), {'__module__': 'ffi'})""")


More information about the pypy-commit mailing list