Skip to content

Commit a397290

Browse files
committed
Add the class variable and the class itself in Ractor::IsolationError
1 parent 74b24e0 commit a397290

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

bootstraptest/test_ractor.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ def initialize
10221022
}
10231023

10241024
# cvar in shareable-objects are not allowed to access from non-main Ractor
1025-
assert_equal 'can not access class variables from non-main Ractors', %q{
1025+
assert_equal 'can not access class variables from non-main Ractors (@@cv from C)', %q{
10261026
class C
10271027
@@cv = 'str'
10281028
end
@@ -1041,7 +1041,7 @@ class C
10411041
}
10421042

10431043
# also cached cvar in shareable-objects are not allowed to access from non-main Ractor
1044-
assert_equal 'can not access class variables from non-main Ractors', %q{
1044+
assert_equal 'can not access class variables from non-main Ractors (@@cv from C)', %q{
10451045
class C
10461046
@@cv = 'str'
10471047
def self.cv

variable.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,7 @@ IVAR_ACCESSOR_SHOULD_BE_MAIN_RACTOR(ID id)
11971197

11981198
#define CVAR_ACCESSOR_SHOULD_BE_MAIN_RACTOR() \
11991199
if (UNLIKELY(!rb_ractor_main_p())) { \
1200-
rb_raise(rb_eRactorIsolationError, "can not access class variables from non-main Ractors"); \
1200+
rb_raise(rb_eRactorIsolationError, "can not access class variables from non-main Ractors (%s from %"PRIsVALUE")", RSTRING_PTR(rb_id2str(id)), klass); \
12011201
}
12021202

12031203
static inline void

0 commit comments

Comments
 (0)