From 4bb1f865fcfb5f6dda9fde30646e7a246f36361c Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 23 Oct 2009 23:37:14 +0000 Subject: * class.c (rb_class_new): move class check to rb_check_inheritable(). * class.c (rb_check_inheritable): should not allow subclass of class Class. [ruby-core:26225] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- class.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'class.c') diff --git a/class.c b/class.c index f8407ca77..351f7aeb3 100644 --- a/class.c +++ b/class.c @@ -97,6 +97,9 @@ rb_check_inheritable(VALUE super) if (RBASIC(super)->flags & FL_SINGLETON) { rb_raise(rb_eTypeError, "can't make subclass of singleton class"); } + if (super == rb_cClass) { + rb_raise(rb_eTypeError, "can't make subclass of Class"); + } } @@ -111,9 +114,6 @@ rb_class_new(VALUE super) { Check_Type(super, T_CLASS); rb_check_inheritable(super); - if (super == rb_cClass) { - rb_raise(rb_eTypeError, "can't make subclass of Class"); - } return rb_class_boot(super); } -- cgit