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