Commit 405ec714 authored by Armin Rigo's avatar Armin Rigo
Browse files

Show a semi-hackish way to get at the value of the arguments when the

crash occurred.
parent bdbb14a1b774
......@@ -43,16 +43,19 @@ class TestFFI(backend_tests.BackendTests,
seen = []
def oops(*args):
seen.append(args)
def cb(n):
def otherfunc():
raise LookupError
def cb(n):
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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment