File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,9 @@ static const char *gvl_event_name(rb_event_flag_t event) {
78
78
struct FrameInfo {
79
79
static const char *label_cstr (VALUE frame) {
80
80
VALUE label = rb_profile_frame_full_label (frame);
81
+ // Currently (2025-03-22, Ruby 3.4.2) this occurs when an iseq method
82
+ // entry is replaced with a refinement
83
+ if (NIL_P (label)) return " (nil)" ;
81
84
return StringValueCStr (label);
82
85
}
83
86
@@ -86,7 +89,7 @@ struct FrameInfo {
86
89
if (NIL_P (file))
87
90
file = rb_profile_frame_path (frame);
88
91
if (NIL_P (file)) {
89
- return " " ;
92
+ return " (nil) " ;
90
93
} else {
91
94
return StringValueCStr (file);
92
95
}
Original file line number Diff line number Diff line change @@ -144,6 +144,26 @@ def test_convert
144
144
assert_equal expected , actual
145
145
end
146
146
147
+ def test_replacing_with_a_refinement
148
+ klass = Class . new do
149
+ def foo
150
+ stack_table = Vernier ::StackTable . new
151
+ stack_table . stack ( stack_table . current_stack )
152
+ end
153
+ end
154
+
155
+ stack = klass . new . foo
156
+
157
+ Module . new do
158
+ refine klass do
159
+ def foo
160
+ end
161
+ end
162
+ end
163
+
164
+ assert_includes stack [ 0 ] . to_s , "(nil) at (nil)"
165
+ end
166
+
147
167
def test_backtrace
148
168
stack_table = Vernier ::StackTable . new
149
169
expected = caller_locations ( 0 ) ; index = stack_table . current_stack
You can’t perform that action at this time.
0 commit comments