Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r2206:5d494c19cb68
Date: 2015-07-04 23:03 +0200
http://bitbucket.org/cffi/cffi/changeset/5d494c19cb68/

Log:    Show a semi-hackish way to get at the value of the arguments when
        the crash occurred.

diff --git a/testing/cffi0/test_ffi_backend.py 
b/testing/cffi0/test_ffi_backend.py
--- a/testing/cffi0/test_ffi_backend.py
+++ b/testing/cffi0/test_ffi_backend.py
@@ -43,16 +43,19 @@
         seen = []
         def oops(*args):
             seen.append(args)
+        def otherfunc():
+            raise LookupError
         def cb(n):
-            raise LookupError
+            otherfunc()
         a = ffi.callback("int(*)(int)", cb, error=42, onerror=oops)
-        res = a(2)
+        res = a(234)
         assert res == 42
         assert len(seen) == 1
         exc, val, tb = seen[0]
         assert exc is LookupError
         assert isinstance(val, LookupError)
         assert tb.tb_frame.f_code.co_name == 'cb'
+        assert tb.tb_frame.f_locals['n'] == 234
 
 
 class TestBitfield:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to