aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2022-11-04 09:02:58 -0400
committerPeter Zhu <peter@peterzhu.ca>2022-11-04 09:02:58 -0400
commit93f364d65e25187ce3c1dd5172a00264804e9380 (patch)
tree1696923c349084a188f0fce742bfa9583a99847e
parent76a6c5d6d16cd0e55df15d66d53c6d7a9614f3d6 (diff)
downloadruby-master.tar.gz
Use RTEST to to check return valueHEADmaster
rb_obj_is_kind_of returns a Ruby Qtrue or Qfalse. We should use RTEST rather than assuming that Qfalse is 0.
-rw-r--r--proc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/proc.c b/proc.c
index 1f047cd04f..a25786c015 100644
--- a/proc.c
+++ b/proc.c
@@ -2571,7 +2571,7 @@ convert_umethod_to_method_components(const struct METHOD *data, VALUE recv, VALU
VALUE refined_class = rb_refinement_module_get_refined_class(methclass);
if (!NIL_P(refined_class)) methclass = refined_class;
}
- if (!RB_TYPE_P(methclass, T_MODULE) && !rb_obj_is_kind_of(recv, methclass)) {
+ if (!RB_TYPE_P(methclass, T_MODULE) && !RTEST(rb_obj_is_kind_of(recv, methclass))) {
if (FL_TEST(methclass, FL_SINGLETON)) {
rb_raise(rb_eTypeError,
"singleton method called for a different object");