From 0fce0545b607e1ac92457cc8523645c294c2d411 Mon Sep 17 00:00:00 2001 From: naruse Date: Mon, 7 May 2012 02:03:28 +0000 Subject: [PATCH] * ext/bigdecimal/bigdecimal.c (Init_bigdecimal): define IDs before they are used. [ruby-core:44900] [Bug #6406] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ ext/bigdecimal/bigdecimal.c | 8 ++++---- test/bigdecimal/test_bigdecimal.rb | 6 ++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2b029da144..65b59b0d94 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon May 7 10:49:36 2012 NARUSE, Yui + + * ext/bigdecimal/bigdecimal.c (Init_bigdecimal): define IDs before + they are used. [ruby-core:44900] [Bug #6406] + Mon May 7 10:27:56 2012 Nobuyoshi Nakada * ext/digest/rmd160/rmd160.c (RMD160_Update): fix for huge data. diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c index 041d33fd7d..a2d705ce20 100644 --- a/ext/bigdecimal/bigdecimal.c +++ b/ext/bigdecimal/bigdecimal.c @@ -2858,6 +2858,10 @@ Init_bigdecimal(void) { VALUE arg; + id_BigDecimal_exception_mode = rb_intern_const("BigDecimal.exception_mode"); + id_BigDecimal_rounding_mode = rb_intern_const("BigDecimal.rounding_mode"); + id_BigDecimal_precision_limit = rb_intern_const("BigDecimal.precision_limit"); + /* Initialize VP routines */ VpInit(0UL); @@ -3053,10 +3057,6 @@ Init_bigdecimal(void) rb_define_singleton_method(rb_mBigMath, "exp", BigMath_s_exp, 2); rb_define_singleton_method(rb_mBigMath, "log", BigMath_s_log, 2); - id_BigDecimal_exception_mode = rb_intern_const("BigDecimal.exception_mode"); - id_BigDecimal_rounding_mode = rb_intern_const("BigDecimal.rounding_mode"); - id_BigDecimal_precision_limit = rb_intern_const("BigDecimal.precision_limit"); - id_up = rb_intern_const("up"); id_down = rb_intern_const("down"); id_truncate = rb_intern_const("truncate"); diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb index 975983c029..9d160dafbe 100644 --- a/test/bigdecimal/test_bigdecimal.rb +++ b/test/bigdecimal/test_bigdecimal.rb @@ -1311,4 +1311,10 @@ class TestBigDecimal < Test::Unit::TestCase code = "exit(BigDecimal.new('10.0') == 10.0.to_d)" assert_ruby_status(%w[-rbigdecimal -rbigdecimal/util -rmathn -], code, bug6093) end + + def test_bug6406 + assert_in_out_err(%w[-rbigdecimal --disable-gems], <<-EOS, [], []) + Thread.current.keys.to_s + EOS + end end