diff --git a/ChangeLog b/ChangeLog index 573002ad94..58f54dc968 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +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] + Sun Jun 27 23:31:17 2010 Nobuyoshi Nakada * include/ruby/io.h, io.c: reverted r21709. diff --git a/class.c b/class.c index 7747a4e4d5..7cc7551b62 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)) {