ruby-changes:20506
From: kosaki <ko1@a...>
Date: Sat, 16 Jul 2011 01:07:04 +0900 (JST)
Subject: [ruby-changes:20506] kosaki:r32554 (trunk): * time.c (time_dup): used rb_obj_class() instead of CLASS_OF().
kosaki 2011-07-16 01:06:53 +0900 (Sat, 16 Jul 2011) New Revision: 32554 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32554 Log: * time.c (time_dup): used rb_obj_class() instead of CLASS_OF(). The patch is made by Kazuki Tsujimoto. [Bug #5012] [ruby-dev:44071] * test/ruby/test_time.rb (TestTime#test_getlocal_dont_share_eigenclass): added a new test for eigenclass of time object. Modified files: trunk/ChangeLog trunk/test/ruby/test_time.rb trunk/time.c Index: time.c =================================================================== --- time.c (revision 32553) +++ time.c (revision 32554) @@ -3430,7 +3430,7 @@ static VALUE time_dup(VALUE time) { - VALUE dup = time_s_alloc(CLASS_OF(time)); + VALUE dup = time_s_alloc(rb_obj_class(time)); time_init_copy(dup, time); return dup; } Index: ChangeLog =================================================================== --- ChangeLog (revision 32553) +++ ChangeLog (revision 32554) @@ -1,3 +1,11 @@ +Sat Jul 16 00:55:38 2011 KOSAKI Motohiro <kosaki.motohiro@g...> + + * time.c (time_dup): used rb_obj_class() instead of CLASS_OF(). + The patch is made by Kazuki Tsujimoto. [Bug #5012] [ruby-dev:44071] + + * test/ruby/test_time.rb (TestTime#test_getlocal_dont_share_eigenclass): + added a new test for eigenclass of time object. + Fri Jul 15 19:11:00 2011 Kenta Murata <mrkn@m...> * bignum.c (bigsub_int): add RB_GC_GUARD. This patch is made by Index: test/ruby/test_time.rb =================================================================== --- test/ruby/test_time.rb (revision 32553) +++ test/ruby/test_time.rb (revision 32554) @@ -697,4 +697,18 @@ off += 0.1 } end + + def test_getlocal_dont_share_eigenclass + bug5012 = "[ruby-dev:44071]" + + t0 = Time.now + class <<t0; end + t1 = t0.getlocal + + def t0.m + 0 + end + + assert_raise(NoMethodError, bug5012) { t1.m } + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/