summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-30 09:09:05 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-30 09:09:05 +0000
commitb1b04e8179c9ed0fdca5b094efac01c6a31a76db (patch)
tree1e606d9a5d36564d27c33cc8c5c96ce98ef3f92d /numeric.c
parent744408df49770c83f13f44e2227af9261486e796 (diff)
* numeric.c (coerce_failed): fixed merge miss of r49443.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@49450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/numeric.c b/numeric.c
index 3d54a0b688..95d8bc952e 100644
--- a/numeric.c
+++ b/numeric.c
@@ -235,9 +235,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