[pypy-svn] r64168 - in pypy/trunk/pypy/module/_rawffi: . test

arigo at codespeak.net arigo at codespeak.net
Thu Apr 16 15:35:23 CEST 2009


Author: arigo
Date: Thu Apr 16 15:35:21 2009
New Revision: 64168

Modified:
   pypy/trunk/pypy/module/_rawffi/callback.py
   pypy/trunk/pypy/module/_rawffi/test/test__rawffi.py
Log:
Force to zero the value returned by a callback raising an exception.


Modified: pypy/trunk/pypy/module/_rawffi/callback.py
==============================================================================
--- pypy/trunk/pypy/module/_rawffi/callback.py	(original)
+++ pypy/trunk/pypy/module/_rawffi/callback.py	Thu Apr 16 15:35:21 2009
@@ -38,6 +38,11 @@
     except OperationError, e:
         tbprint(space, space.wrap(e.application_traceback),
                 space.wrap(e.errorstr(space)))
+        # force the result to be zero
+        if callback_ptr.result != 'O':
+            _, size, _ = letter2tp(space, callback_ptr.result)
+            for i in range(size):
+                ll_res[i] = '\x00'
 
 # XXX some weird hackery to be able to recover W_CallbackPtr object
 #     out of number    

Modified: pypy/trunk/pypy/module/_rawffi/test/test__rawffi.py
==============================================================================
--- pypy/trunk/pypy/module/_rawffi/test/test__rawffi.py	(original)
+++ pypy/trunk/pypy/module/_rawffi/test/test__rawffi.py	Thu Apr 16 15:35:21 2009
@@ -575,6 +575,7 @@
             val = err.getvalue()
             assert 'ZeroDivisionError' in val
             assert 'callback' in val
+            assert res[0] == 0L
         finally:
             sys.stderr = orig
 



More information about the Pypy-commit mailing list