mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
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.
This commit is contained in:
parent
b7e751181e
commit
f64c89f18d
Notes:
git
2025-05-23 19:13:36 +00:00
2 changed files with 22 additions and 0 deletions
3
ractor.c
3
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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue