From 297cb521c1a39189da99d23b6a24c8558204992b Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 16 May 2005 13:28:59 +0000 Subject: * 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/branches/ruby_1_8@8469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- class.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'class.c') diff --git a/class.c b/class.c index 8addef7612..b7f05dd4e5 100644 --- a/class.c +++ b/class.c @@ -92,6 +92,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); } -- cgit v1.2.3