diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | class.c | 3 | ||||
-rw-r--r-- | object.c | 1 |
3 files changed, 10 insertions, 1 deletions
@@ -1,8 +1,13 @@ +Mon Dec 22 21:15:29 2003 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * class.c (rb_mod_init_copy): always copy singleton class. + [ruby-dev:22325] + Mon Dec 22 20:44:36 2003 akira yamada <akira@ruby-lang.org> * lib/uri/generic.rb (URI::Generic#route_from): accepts urls which has no host-part. - + * test/uri/test_generic.rb (TestGeneric::test_route): added a test. Mon Dec 22 20:38:44 2003 Nobuyoshi Nakada <nobu@ruby-lang.org> @@ -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; @@ -1662,6 +1662,7 @@ Init_Object() rb_define_method(rb_cClass, "allocate", rb_obj_alloc, 0); rb_define_method(rb_cClass, "new", rb_class_new_instance, -1); rb_define_method(rb_cClass, "initialize", rb_class_initialize, -1); + rb_define_method(rb_cClass, "initialize_copy", rb_class_init_copy, 1); rb_define_method(rb_cClass, "superclass", rb_class_superclass, 0); rb_define_alloc_func(rb_cClass, rb_class_s_alloc); rb_undef_method(rb_cClass, "extend_object"); |