mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
748325b80d
commit
6a852f7ab8
1 changed files with 7 additions and 2 deletions
|
@ -237,9 +237,14 @@ NORETURN(static void coerce_failed(VALUE x, VALUE y));
|
||||||
static void
|
static void
|
||||||
coerce_failed(VALUE x, VALUE y)
|
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_raise(rb_eTypeError, "%"PRIsVALUE" can't be coerced into %"PRIsVALUE,
|
||||||
(rb_special_const_p(y)? rb_inspect(y) : rb_obj_class(y)),
|
y, rb_obj_class(x));
|
||||||
rb_obj_class(x));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
|
Loading…
Add table
Reference in a new issue