[pypy-commit] cffi default: A convenient way to change the default return value of 0 in case the
arigo
noreply at buildbot.pypy.org
Mon Jun 25 12:21:10 CEST 2012
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r508:dd6230e7ea2e
Date: 2012-06-25 12:20 +0200
http://bitbucket.org/cffi/cffi/changeset/dd6230e7ea2e/
Log: A convenient way to change the default return value of 0 in case the
callback crashes.
diff --git a/testing/backend_tests.py b/testing/backend_tests.py
--- a/testing/backend_tests.py
+++ b/testing/backend_tests.py
@@ -655,6 +655,15 @@
assert a == b
assert hash(a) == hash(b)
+ def test_callback_crash(self):
+ py.test.skip("in-progress")
+ ffi = FFI(backend=self.Backend())
+ def cb(n):
+ raise Exception
+ a = ffi.callback("int(*)(int)", cb, error=42)
+ res = a(1) # and the error reported to stderr
+ assert res == 42
+
def test_cast_float(self):
ffi = FFI(backend=self.Backend())
a = ffi.cast("float", 12)
More information about the pypy-commit
mailing list