Now SharedObjectManager.__enter__/__exit__ invoke the JIT-compiled setup an teardown symbols directly via ctypes
self.setup(ctypes.c_int(argc), array_of_char_ptrs)
...
self.teardown()
If either function throws a C++ exception (e.g. RT_FAIL) the unwinder hits the ctypes C frame, which has no C++ exception handler. libc++abi falls back to std::terminate() and the interpreter aborts:
libc++abi: terminating due to uncaught exception of type
Catalyst::Runtime::RuntimeException: ...
An obvious way to let the exception handler can capture this error is to make nanobind wrappers for both setup and teardown just like what we did for wrapper.wrap for launching the entry function of the circuit.
Now
SharedObjectManager.__enter__/__exit__invoke the JIT-compiledsetupanteardownsymbols directly viactypesIf either function throws a C++ exception (e.g.
RT_FAIL) the unwinder hits the ctypes C frame, which has no C++ exception handler. libc++abi falls back tostd::terminate()and the interpreter aborts:An obvious way to let the exception handler can capture this error is to make nanobind wrappers for both
setupandteardownjust like what we did forwrapper.wrapfor launching the entry function of the circuit.