From b348d297fe848fdaf4dc74f9e4073e6ab82d3244 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: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@8469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 ++++- class.c | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 825575d8a..e7bc5a180 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,11 @@ -Mon May 16 22:21:44 2005 Nobuyoshi Nakada +Mon May 16 22:28:43 2005 Nobuyoshi Nakada * win32/win32.h, {bcc32,win32,wince}/Makefile.sub: moved rb_[ugp]id_t to get rid of redefinition warnings on mingw. + * class.c (rb_class_init_copy): singleton class is disallowed to copy, + from its definition. fixed: [ruby-talk:142749] + Mon May 16 08:52:29 2005 Hirokazu Yamamoto * win32/win32.{h,c}: define rb_{p,g,u}id_t. diff --git a/class.c b/class.c index 8addef761..b7f05dd4e 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