lucifer1004 opened a new pull request, #814:
URL: https://github.com/apache/tvm-ffi/pull/814

   
   ## Why
   
   A Rust function called through the tvm-ffi C ABI runs inside an `extern "C"` 
function, whether it is exported with `tvm_ffi_dll_export_typed_func!` or 
wrapped by `Function::from_typed` / `Function::from_packed`. A panic there 
cannot unwind into the caller, so the process aborts. This includes panics from 
indexing, `unwrap`, or checks such as `TensorView::strides`.
   
   ## What
   
   Both boundaries now complete the call through 
`function_internal::complete_safe_call`. It stores the returned value, raises a 
returned error, or catches a panic and raises it as a `RuntimeError` with the 
panic message (`panicked: <message>`). The function stays usable after a panic. 
The macro's documentation states the behavior.
   
   ## Tests
   
   `rust/tvm-ffi/tests/test_function.rs`: a panicking exported function and a 
panicking `Function::from_typed` callback each raise `RuntimeError` carrying 
the message, and the callback works again afterwards. `cargo test` passes 
against libtvm_ffi built from `main`.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to