diff options
author | Armin Rigo <arigo@tunes.org> | 2015-07-04 23:03:13 +0200 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2015-07-04 23:03:13 +0200 |
commit | 0ee2d972ee16b23130f143710dbabf6088fc564f (patch) | |
tree | f6d933f6db630db592e77e73d8ce0e489f04ab4d | |
parent | 02681107ba90bf0ae1884c4bab813ee5b17f26fa (diff) | |
download | cffi-0ee2d972ee16b23130f143710dbabf6088fc564f.tar.gz |
Show a semi-hackish way to get at the value of the arguments when the
crash occurred.
-rw-r--r-- | testing/cffi0/test_ffi_backend.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/testing/cffi0/test_ffi_backend.py b/testing/cffi0/test_ffi_backend.py index 88ee451..c01a465 100644 --- a/testing/cffi0/test_ffi_backend.py +++ b/testing/cffi0/test_ffi_backend.py @@ -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: |