From f9c1b7a46a9cf2c5950b7096e18cde957db671d0 Mon Sep 17 00:00:00 2001 From: Mehmet Emin INAC Date: Thu, 26 Aug 2021 07:08:49 +0200 Subject: [PATCH] Use C-level API to generate object identifier Related to https://github.com/ruby/did_you_mean/issues/158 --- error.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/error.c b/error.c index 79a24a71fd09f5..13e2f50306aeed 100644 --- a/error.c +++ b/error.c @@ -1987,10 +1987,8 @@ name_err_mesg_to_str(VALUE obj) default: d = rb_protect(name_err_mesg_receiver_name, obj, &state); if (state || d == Qundef || d == Qnil) - d = rb_protect(rb_inspect, obj, &state); - if (state) { - rb_set_errinfo(Qnil); - } + d = rb_any_to_s(obj); + d = rb_check_string_type(d); if (NIL_P(d)) { d = rb_any_to_s(obj);