From 6a852f7ab800dae868e2246b890a66c6dc07aead Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 13 Jan 2015 12:07:14 +0000 Subject: [PATCH] numeric.c: fix message * numeric.c (coerce_failed): fix the error message on non-flonum platforms. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- numeric.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/numeric.c b/numeric.c index 7458797866..0222c76e29 100644 --- a/numeric.c +++ b/numeric.c @@ -237,9 +237,14 @@ NORETURN(static void coerce_failed(VALUE x, VALUE y)); static void coerce_failed(VALUE x, VALUE y) { + if (SPECIAL_CONST_P(y) || BUILTIN_TYPE(y) == T_FLOAT) { + y = rb_inspect(y); + } + else { + y = rb_obj_class(y); + } rb_raise(rb_eTypeError, "%"PRIsVALUE" can't be coerced into %"PRIsVALUE, - (rb_special_const_p(y)? rb_inspect(y) : rb_obj_class(y)), - rb_obj_class(x)); + y, rb_obj_class(x)); } static VALUE