File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ Tue Jun 30 11:56:24 2015 Eric Wong <e@80x24.org>
2+
3+ * numeric.c (bit_coerce): use original value for error message
4+ [ruby-core:67405] [Bug #10711]
5+ * test/ruby/test_numeric.rb (test_coerce): check error message
6+
17Mon Jun 29 13:22:14 2015 Shota Fukumori <her@sorah.jp>
28
39 * ext/objspace/objspace_dump.c(dump_object): Return empty JSON object when
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ rb_cmperr(VALUE x, VALUE y)
2020{
2121 const char * classname ;
2222
23- if (SPECIAL_CONST_P (y )) {
23+ if (SPECIAL_CONST_P (y ) || BUILTIN_TYPE ( y ) == T_FLOAT ) {
2424 y = rb_inspect (y );
2525 classname = StringValuePtr (y );
2626 }
Original file line number Diff line number Diff line change @@ -3299,11 +3299,12 @@ static int
32993299bit_coerce (VALUE * x , VALUE * y , int err )
33003300{
33013301 if (!FIXNUM_P (* y ) && !RB_TYPE_P (* y , T_BIGNUM )) {
3302+ VALUE orig = * x ;
33023303 do_coerce (x , y , err );
33033304 if (!FIXNUM_P (* x ) && !RB_TYPE_P (* x , T_BIGNUM )
33043305 && !FIXNUM_P (* y ) && !RB_TYPE_P (* y , T_BIGNUM )) {
33053306 if (!err ) return FALSE;
3306- coerce_failed (* x , * y );
3307+ coerce_failed (orig , * y );
33073308 }
33083309 }
33093310 return TRUE;
Original file line number Diff line number Diff line change @@ -28,6 +28,10 @@ def test_coerce
2828 assert_raise_with_message ( TypeError , /:"\\ u3042"/ ) { 1 |:"\u{3042} " }
2929 assert_raise_with_message ( TypeError , /:"\\ u3042"/ ) { 1 ^:"\u{3042} " }
3030 end
31+
32+ bug10711 = '[ruby-core:67405] [Bug #10711]'
33+ exp = "1.2 can't be coerced into Fixnum"
34+ assert_raise_with_message ( TypeError , exp , bug10711 ) { 1 & 1.2 }
3135 end
3236
3337 def test_dummynumeric
Original file line number Diff line number Diff line change 11#define RUBY_VERSION "2.1.7"
2- #define RUBY_RELEASE_DATE "2015-06-29 "
3- #define RUBY_PATCHLEVEL 368
2+ #define RUBY_RELEASE_DATE "2015-06-30 "
3+ #define RUBY_PATCHLEVEL 369
44
55#define RUBY_RELEASE_YEAR 2015
66#define RUBY_RELEASE_MONTH 6
7- #define RUBY_RELEASE_DAY 29
7+ #define RUBY_RELEASE_DAY 30
88
99#include "ruby/version.h"
1010
You can’t perform that action at this time.
0 commit comments