Skip to content

Uncaught exception from setup/teardown functions #2885

@rniczh

Description

@rniczh

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions