From 640420f7044405cec4b1e6486caca4def5f80a45 Mon Sep 17 00:00:00 2001 From: mrkn Date: Mon, 29 Aug 2011 01:07:15 +0000 Subject: * 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 --- numeric.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'numeric.c') 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; } -- cgit v1.2.3