Skip to content

Commit 0ba6299

Browse files
committed
Add the instance variable name and the module in Ractor::IsolationError
1 parent e42bcd7 commit 0ba6299

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
@@ -1444,7 +1444,8 @@ rb_ivar_lookup(VALUE obj, ID id, VALUE undef)
14441444
UNLIKELY(!rb_ractor_main_p()) &&
14451445
!rb_ractor_shareable_p(val)) {
14461446
rb_raise(rb_eRactorIsolationError,
1447-
"can not get unshareable values from instance variables of classes/modules from non-main Ractors");
1447+
"can not get unshareable values from instance variables of classes/modules from non-main Ractors (%"PRIsVALUE" from %"PRIsVALUE")",
1448+
rb_id2str(id), obj);
14481449
}
14491450
return val;
14501451
}

0 commit comments

Comments
 (0)