From 2a43e8983da9b7efbe03e910e0ce41acf003abfa Mon Sep 17 00:00:00 2001 From: yugui Date: Thu, 1 Jul 2010 02:05:28 +0000 Subject: merges r28453 and r28454 from trunk into ruby_1_9_2. -- * class.c (rb_mod_init_copy): when class is dup'ed, a metaclass of the class should be attached to the dup'ed class, not the original class. [ruby-core:30843] [Bug #3461] -- * bootstraptest/test_class.rb: add a test for [ruby-core:30843]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 10 ++++++++++ bootstraptest/test_class.rb | 7 +++++++ class.c | 1 + 3 files changed, 18 insertions(+) diff --git a/ChangeLog b/ChangeLog index 4dfb0703e5..85f7dd4f47 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Mon Jun 28 03:12:03 2010 Yusuke Endoh + + * bootstraptest/test_class.rb: add a test for [ruby-core:30843]. + +Mon Jun 28 02:43:35 2010 Yusuke Endoh + + * class.c (rb_mod_init_copy): when class is dup'ed, a metaclass of the + class should be attached to the dup'ed class, not the original + class. [ruby-core:30843] [Bug #3461] + Sat Jun 26 07:59:18 2010 Masaki Suketa * test/win32ole/test_win32ole_method.rb (test_offset_vtbl): check diff --git a/bootstraptest/test_class.rb b/bootstraptest/test_class.rb index a7f6d4df47..664dd2f166 100644 --- a/bootstraptest/test_class.rb +++ b/bootstraptest/test_class.rb @@ -150,3 +150,10 @@ assert_match /::C\z/, %q{ Module.new{|m| c = class m::C; name; end} c }, '[ruby-dev:38456]' + +assert_normal_exit %q{ + s = Symbol.dup + class << s + end + s.allocate.to_s +}, '[ruby-core:30843]' diff --git a/class.c b/class.c index ac51f8e02b..e6fb74816b 100644 --- a/class.c +++ b/class.c @@ -146,6 +146,7 @@ rb_mod_init_copy(VALUE clone, VALUE orig) rb_obj_init_copy(clone, orig); if (!FL_TEST(CLASS_OF(clone), FL_SINGLETON)) { RBASIC(clone)->klass = rb_singleton_class_clone(orig); + rb_singleton_class_attached(RBASIC(clone)->klass, (VALUE)clone); } RCLASS_SUPER(clone) = RCLASS_SUPER(orig); if (RCLASS_IV_TBL(orig)) { -- cgit v1.2.3