From 65fed5dad3dbcbb60cc6ccffd4e43359ec29ffb4 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 22 Dec 2003 12:15:34 +0000 Subject: * class.c (rb_mod_init_copy): always copy singleton class. [ruby-dev:22325] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- class.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'class.c') diff --git a/class.c b/class.c index 29fe34a915..35b2c985ae 100644 --- a/class.c +++ b/class.c @@ -63,6 +63,9 @@ rb_mod_init_copy(clone, orig) VALUE clone, orig; { rb_obj_init_copy(clone, orig); + if (!FL_TEST(CLASS_OF(clone), FL_SINGLETON)) { + RBASIC(clone)->klass = rb_singleton_class_clone(orig); + } RCLASS(clone)->super = RCLASS(orig)->super; if (RCLASS(orig)->iv_tbl) { ID id; -- cgit v1.2.3