summaryrefslogtreecommitdiffstats
path: root/class.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-22 12:15:34 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-22 12:15:34 +0000
commitc12a5acfc2b0a97beaff67513f695555f668a4b9 (patch)
tree89d4722df33c2ec8e115078fa88cdc286842e454 /class.c
parent1cffc0574cf57a357b02b916500f7a901b553713 (diff)
downloadruby-c12a5acfc2b0a97beaff67513f695555f668a4b9.tar.gz
ruby-c12a5acfc2b0a97beaff67513f695555f668a4b9.tar.xz
ruby-c12a5acfc2b0a97beaff67513f695555f668a4b9.zip
* class.c (rb_mod_init_copy): always copy singleton class.
[ruby-dev:22325] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@5251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'class.c')
-rw-r--r--class.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/class.c b/class.c
index 29fe34a91..35b2c985a 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;