Skip to content

Catch exceptions thrown from setup/teardown#2889

Open
rniczh wants to merge 4 commits into
mainfrom
rniczh/catch-exception-from-setup-and-teardown
Open

Catch exceptions thrown from setup/teardown#2889
rniczh wants to merge 4 commits into
mainfrom
rniczh/catch-exception-from-setup-and-teardown

Conversation

@rniczh

@rniczh rniczh commented May 28, 2026

Copy link
Copy Markdown
Member

Context:

If either function, setup and teardown ,throws a C++ exception like 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: ...

Description of the Change:

Add two nanobind bindings (wrapper.invoke_setup / wrapper.invoke_teardown) that call the underlying C function pointers, and route __enter__/__exit__ through them.

  • Add test

Benefits:

Possible Drawbacks:

Related GitHub Issues:

#2885
[sc-119222]

@codecov

codecov Bot commented May 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.01%. Comparing base (bea94d8) to head (433319f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2889      +/-   ##
==========================================
- Coverage   97.01%   97.01%   -0.01%     
==========================================
  Files         167      167              
  Lines       18830    18826       -4     
  Branches     1770     1770              
==========================================
- Hits        18268    18264       -4     
  Misses        417      417              
  Partials      145      145              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rniczh rniczh requested a review from a team June 4, 2026 18:47
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md on your branch with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant