From ad6f06aed8bf9b753622809441c4db0d523cd41f Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 29 Dec 2012 02:37:47 +0000 Subject: 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 --- object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'object.c') diff --git a/object.c b/object.c index 8c85e0d657..660be571ab 100644 --- a/object.c +++ b/object.c @@ -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); -- cgit v1.2.3