summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-29 01:07:15 +0000
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-29 01:07:15 +0000
commit640420f7044405cec4b1e6486caca4def5f80a45 (patch)
treefe7c8c31a09aaf3ccf0f483c9926c0528bde2513 /numeric.c
parent0d530b2392585cc535fb905f9ba4467257ef289c (diff)
* numeric.c (bit_coerce): A Fixnum and a Bignum are only permitted for
bitwise arithmetic with a Fixnum. #1792 * test/ruby/test_fixnum.rb: add tests for the above change. * bignum.c (bit_coerce): A Fixnum and a Bignum are only permitted for bitwise arithmetic with a Bignum. #1792 * test/ruby/test_bignum.rb: add tests for the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/numeric.c b/numeric.c
index ab890c6153..96a3022e84 100644
--- a/numeric.c
+++ b/numeric.c
@@ -2917,10 +2917,9 @@ static VALUE
bit_coerce(VALUE x)
{
while (!FIXNUM_P(x) && TYPE(x) != T_BIGNUM) {
- if (TYPE(x) == T_FLOAT) {
- rb_raise(rb_eTypeError, "can't convert Float into Integer");
- }
- x = rb_to_int(x);
+ rb_raise(rb_eTypeError,
+ "can't convert %s into Integer for bitwise arithmetic",
+ rb_obj_classname(x));
}
return x;
}