Skip to content

Commit ee15197

Browse files
committed
merge revision(s) 49224,49225,49234,49235: [Backport ruby#10711]
* numeric.c (bit_coerce): use original value for error message [ruby-core:67405] [Bug ruby#10711] * test/ruby/test_numeric.rb (test_coerce): check error message git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@51067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 61f3bae commit ee15197

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
Tue Jun 30 11:56:24 2015 Eric Wong <[email protected]>
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+
17
Mon Jun 29 13:22:14 2015 Shota Fukumori <[email protected]>
28

39
* ext/objspace/objspace_dump.c(dump_object): Return empty JSON object when

compar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
}

numeric.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3299,11 +3299,12 @@ static int
32993299
bit_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;

test/ruby/test_numeric.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff 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

version.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
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

0 commit comments

Comments
 (0)