summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--class.c3
-rw-r--r--object.c1
3 files changed, 10 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 85b520c9fc..ac0ad5d5a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
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;
diff --git a/object.c b/object.c
index fda6410274..174d8ccfc0 100644
--- a/object.c
+++ b/object.c
@@ -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");