Skip to content

Commit 9fc322b

Browse files
committed
Fix spec to pass the correct flags for MRI
1 parent d84b148 commit 9fc322b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

spec/ruby/optional/capi/ext/object_spec.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,15 @@ static VALUE object_spec_rb_class_inherited_p(VALUE self, VALUE mod, VALUE arg)
346346
}
347347

348348
static VALUE speced_allocator(VALUE klass) {
349-
VALUE instance = rb_newobj_of(klass, 0);
349+
VALUE flags = 0;
350+
if (rb_class_inherited_p(klass, rb_cString)) {
351+
flags = T_STRING;
352+
} else if (rb_class_inherited_p(klass, rb_cArray)) {
353+
flags = T_ARRAY;
354+
} else {
355+
flags = T_OBJECT;
356+
}
357+
VALUE instance = rb_newobj_of(klass, flags);
350358
rb_iv_set(instance, "@from_custom_allocator", Qtrue);
351359
return instance;
352360
}

0 commit comments

Comments
 (0)