diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-01-13 12:07:14 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-01-13 12:07:14 +0000 |
commit | 6a852f7ab800dae868e2246b890a66c6dc07aead (patch) | |
tree | 93b7bf28062265f1f29c3e1ab4ba36f925016b73 /numeric.c | |
parent | 748325b80de254374a5a71e2e07a2a70d7ea9318 (diff) | |
download | ruby-6a852f7ab800dae868e2246b890a66c6dc07aead.tar.gz |
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
Diffstat (limited to 'numeric.c')
-rw-r--r-- | numeric.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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 |