summaryrefslogtreecommitdiff
path: root/ractor.c
diff options
context:
space:
mode:
authorLuke Gruber <[email protected]>2025-05-23 11:12:14 -0400
committerJean Boussier <[email protected]>2025-05-23 21:13:23 +0200
commitf64c89f18d3a0cd15ea334d43f73f72e7bd99140 (patch)
tree5cf4aabd85183cd3c7a3217ed2d1dedc2364a02a /ractor.c
parentb7e751181eefbce272958d62c26e396ac16363c1 (diff)
Fix 'require' from a ractor when the required file raises an error
If you catch an error that was raised from a file you required in a ractor, that error did not have its belonging reset from the main ractor to the current ractor, so you hit assertion errors in debug mode.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13428
Diffstat (limited to 'ractor.c')
-rw-r--r--ractor.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ractor.c b/ractor.c
index 101dc41562..e8d2f7a69e 100644
--- a/ractor.c
+++ b/ractor.c
@@ -4217,9 +4217,12 @@ rb_ractor_require(VALUE feature)
rb_ractor_channel_close(ec, crr.ch);
if (crr.exception != Qundef) {
+ ractor_reset_belonging(crr.exception);
rb_exc_raise(crr.exception);
}
else {
+ RUBY_ASSERT(crr.result != Qundef);
+ ractor_reset_belonging(crr.result);
return crr.result;
}
}