diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-29 02:37:47 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-29 02:37:47 +0000 |
commit | ad6f06aed8bf9b753622809441c4db0d523cd41f (patch) | |
tree | c5efd6b6403efde336be0f4d01a3e900a63fdbee /object.c | |
parent | 11803022002e188eb94868335d79ea2b16bd7934 (diff) |
object.c: singleton class clone
* object.c (rb_obj_clone): attach clone to its singleton class during
cloning singleton class so that singleton_method_added will be called
on it. based on the patch by shiba (satoshi shiba)[Bug #5283] in
[ruby-dev:44477]. [Bug #5283]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -298,7 +298,7 @@ rb_obj_clone(VALUE obj) rb_raise(rb_eTypeError, "can't clone %s", rb_obj_classname(obj)); } clone = rb_obj_alloc(rb_obj_class(obj)); - singleton = rb_singleton_class_clone(obj); + singleton = rb_singleton_class_clone_and_attach(obj, clone); RBASIC(clone)->klass = singleton; if (FL_TEST(singleton, FL_SINGLETON)) { rb_singleton_class_attached(singleton, clone); |