diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ext/bigdecimal/bigdecimal.c | 2 | ||||
-rw-r--r-- | test/bigdecimal/test_bigdecimal.rb | 13 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 21 insertions, 2 deletions
@@ -1,3 +1,9 @@ +Mon Feb 27 17:25:40 2012 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): since methods + can be overridden, so should not make an assumption on the type + of results. [ruby-core:42969][Bug #6093] + Mon Feb 27 02:28:17 2012 NARUSE, Yui <naruse@ruby-lang.org> * regparse.c (add_code_range_to_buf0): wrong condition of duplicated diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c index f57ea9051d..d9f72018ef 100644 --- a/ext/bigdecimal/bigdecimal.c +++ b/ext/bigdecimal/bigdecimal.c @@ -210,7 +210,7 @@ again: if (prec < 0) goto unable_to_coerce_without_prec; if (prec > DBL_DIG+1)goto SomeOneMayDoIt; v = rb_funcall(v, id_to_r, 0); - /* fall through */ + goto again; case T_RATIONAL: if (prec < 0) goto unable_to_coerce_without_prec; diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb index a9524bb2ae..bd0739c31d 100644 --- a/test/bigdecimal/test_bigdecimal.rb +++ b/test/bigdecimal/test_bigdecimal.rb @@ -1,4 +1,5 @@ require_relative "testbase" +require_relative "../ruby/envutil" require 'thread' @@ -1284,4 +1285,16 @@ class TestBigDecimal < Test::Unit::TestCase end end end + + def test_to_d + bug6093 = '[ruby-core:42969]' + code = "exit(BigDecimal.new('10.0') == 10.0.to_d)" + assert_ruby_status(%w[-rbigdecimal -rbigdecimal/util -rmathn -], code, bug6093) + end + + def test_to_d + bug6093 = '[ruby-core:42969]' + code = "exit(BigDecimal.new('10.0') == 10.0.to_d)" + assert_ruby_status(%w[-rbigdecimal -rbigdecimal/util -rmathn -], code, bug6093) + end end @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.3" -#define RUBY_PATCHLEVEL 151 +#define RUBY_PATCHLEVEL 152 #define RUBY_RELEASE_DATE "2012-02-27" #define RUBY_RELEASE_YEAR 2012 |