Skip to content

Commit aab4f62

Browse files
Add the instance variable name and the module in Ractor::IsolationError (ruby#15563)
1 parent 09a29e1 commit aab4f62

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

bootstraptest/test_ractor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ def ractor_local_globals
846846
}
847847

848848
# ivar in shareable-objects are not allowed to access from non-main Ractor
849-
assert_equal "can not get unshareable values from instance variables of classes/modules from non-main Ractors", <<~'RUBY', frozen_string_literal: false
849+
assert_equal "can not get unshareable values from instance variables of classes/modules from non-main Ractors (@iv from C)", <<~'RUBY', frozen_string_literal: false
850850
class C
851851
@iv = 'str'
852852
end

variable.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1447,7 +1447,8 @@ rb_ivar_lookup(VALUE obj, ID id, VALUE undef)
14471447
UNLIKELY(!rb_ractor_main_p()) &&
14481448
!rb_ractor_shareable_p(val)) {
14491449
rb_raise(rb_eRactorIsolationError,
1450-
"can not get unshareable values from instance variables of classes/modules from non-main Ractors");
1450+
"can not get unshareable values from instance variables of classes/modules from non-main Ractors (%"PRIsVALUE" from %"PRIsVALUE")",
1451+
rb_id2str(id), obj);
14511452
}
14521453
return val;
14531454
}

0 commit comments

Comments
 (0)