summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-08-16 10:15:28 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-08-16 10:15:28 +0000
commit9528358120511f0587be39c853f5916cf8d05a9d (patch)
tree3b626a2aab86b68d1af92ec27352b1068dcb4a7f /object.c
parenta39b94d3022e37f4a5c3ce7cd112ac01f6e2ceec (diff)
object.c: forbid uninitialized class
* object.c (rb_class_initialize): forbid inheriting uninitialized class. another class tree not based on BasicObject cannot exist. [ruby-core:47148][Bug #6863] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r--object.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/object.c b/object.c
index b7e1b58c81..73f76fa753 100644
--- a/object.c
+++ b/object.c
@@ -1616,6 +1616,9 @@ rb_class_initialize(int argc, VALUE *argv, VALUE klass)
else {
rb_scan_args(argc, argv, "01", &super);
rb_check_inheritable(super);
+ if (super != rb_cBasicObject && !RCLASS_SUPER(super)) {
+ rb_raise(rb_eTypeError, "can't inherit uninitialized class");
+ }
}
RCLASS_SUPER(klass) = super;
rb_make_metaclass(klass, RBASIC(super)->klass);