summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-05-16 13:28:59 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-05-16 13:28:59 +0000
commitdb218799e8bc4217327124d6802a943b739040d4 (patch)
tree276607743bebf0a8c8a94394456c0433b3031e8d /class.c
parenta3c29ec51ac19043859728696f568b095ac739e6 (diff)
* class.c (rb_class_init_copy): singleton class is disallowed to copy,
from its definition. fixed: [ruby-talk:142749] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8469 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 59f608732f..b3cec55065 100644
--- a/class.c
+++ b/class.c
@@ -105,6 +105,9 @@ rb_class_init_copy(clone, orig)
if (RCLASS(clone)->super != 0) {
rb_raise(rb_eTypeError, "already initialized class");
}
+ if (FL_TEST(orig, FL_SINGLETON)) {
+ rb_raise(rb_eTypeError, "can't copy singleton class");
+ }
return rb_mod_init_copy(clone, orig);
}