From b09eabd430d92cdae011bb7ad08a3300049a4392 Mon Sep 17 00:00:00 2001 From: shugo Date: Sat, 6 Feb 2010 15:26:34 +0000 Subject: * class.c (rb_class_init_copy): raise a TypeError if the argument is BasicObject. [ruby-core:27060] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26607 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 6674ae1a9d..fed2edf4ee 100644 --- a/class.c +++ b/class.c @@ -180,6 +180,9 @@ rb_mod_init_copy(VALUE clone, VALUE orig) VALUE rb_class_init_copy(VALUE clone, VALUE orig) { + if (orig == rb_cBasicObject) { + rb_raise(rb_eTypeError, "can't copy the root class"); + } if (RCLASS_SUPER(clone) != 0 || clone == rb_cBasicObject) { rb_raise(rb_eTypeError, "already initialized class"); } -- cgit v1.2.3