Repository navigation
fix(loaders): return throwable on raised errors in rb_loader and lua_loader and test conversion - #952
Merged
Merged
Conversation
anmoltrivedi2312-ux
force-pushed
the
develop
branch
from
November 10, 2026 19:58
f9f8445 to
3e5bc68
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This ensures runtime exceptions are handled consistently between loaders. Any function which throws an error will return
METACALL_THROWABLErather thanNULL. Themetacall_conversion_testnow also checks for throwables.Changes
py_loader(py_loader_impl.c)py_loader_impl_error_valueandpy_loader_impl_error_value_from_exceptionfunctions topy_loader_impl_throwable_valueandpy_loader_impl_exception_valuerespectively. This aligns with the underlying MetaCall type namesTYPE_THROWABLEandTYPE_EXCEPTION.rb_loader(rb_loader_impl.c)rb_eExceptiondeserialization fromrb_type_deserializefunction torb_loader_impl_exception_value(VALUE v). This includes all backtraces (joined by\n),errnoextraction, andStringValueCStr.rb_loader_impl_print_last_exceptionfunction withrb_loader_impl_throwable_value(void). This function takesrb_errinfo(), sets$!to nil (rb_set_errinfo(Qnil)), and wraps the exception in a throwable. All 4 paths callingrb_protecthave been updated accordingly (fix(rb_loader): return TYPE_THROWABLE from invoke path on Ruby exception #689).lua_loader(lua_loader_impl.c,metacall_lua_mixed_test.cpp)lua_loader_impl_exception_valueandlua_loader_impl_throwable_valuefunctions. These will returnMETACALL_THROWABLEifstatus != 0fromlua_pcall.runtime_error_propagationandruntime_error_with_nil_accessfunctions inmetacall_lua_mixed_test.cppto check forMETACALL_THROWABLE.metacall_conversion_test(metacall_conversion_test.cpp)throwable_functions have been added for node, py, rb, and lua. These functions are checked to ensure they returnMETACALL_THROWABLE.metacall::metacall_destroy()at the end of test. This ensures that reflect memory tracker counts are balanced.