From e9ef9bd0dbf1807ad82dc7227abbedff9d806a09 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 27 Feb 2012 08:25:46 +0000 Subject: merge revision(s) 34829: * 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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ ext/bigdecimal/bigdecimal.c | 2 +- test/bigdecimal/test_bigdecimal.rb | 13 +++++++++++++ version.h | 2 +- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2a24f138f8..4331024ce3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Mon Feb 27 17:25:40 2012 Nobuyoshi Nakada + + * 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 * 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 diff --git a/version.h b/version.h index af20149bc7..ed089bf95d 100644 --- a/version.h +++ b/version.h @@ -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 -- cgit v1.2.3