Skip to content

Commit 750aa1c

Browse files
shyouheieregon
authored andcommitted
rb_class_inherited_p returns Ruby's true/false/nil
From: https://github.com/ruby/ruby/blob/6b86549df8f6d48eeab3c7b48b3fd9ee02f744ba/object.c#L1828-L1846 > Returns <code>nil</code> if there's no relationship between the two.
1 parent 41bf282 commit 750aa1c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

optional/capi/ext/object_spec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,9 @@ static VALUE object_spec_rb_class_inherited_p(VALUE self, VALUE mod, VALUE arg)
348348
static VALUE speced_allocator(VALUE klass) {
349349
VALUE flags = 0;
350350
VALUE instance;
351-
if (rb_class_inherited_p(klass, rb_cString)) {
351+
if (RTEST(rb_class_inherited_p(klass, rb_cString))) {
352352
flags = T_STRING;
353-
} else if (rb_class_inherited_p(klass, rb_cArray)) {
353+
} else if (RTEST(rb_class_inherited_p(klass, rb_cArray))) {
354354
flags = T_ARRAY;
355355
} else {
356356
flags = T_OBJECT;

0 commit comments

Comments
 (0)