Project

General

Profile

Bug #6863 ยป type-error-on-class-inheriting-from-self.patch

Anonymous, 08/13/2012 10:35 PM

View differences:

object.c
static VALUE
rb_class_initialize(int argc, VALUE *argv, VALUE klass)
{
VALUE super;
VALUE super, i;
if (RCLASS_SUPER(klass) != 0 || klass == rb_cBasicObject) {
rb_raise(rb_eTypeError, "already initialized class");
......
rb_scan_args(argc, argv, "01", &super);
rb_check_inheritable(super);
}
for(i = super; i && i != rb_cBasicObject; i = RCLASS_SUPER(i)) {
if(i == klass) {
rb_raise(rb_eTypeError, "circular inheritance detected");
}
}
RCLASS_SUPER(klass) = super;
rb_make_metaclass(klass, RBASIC(super)->klass);
rb_class_inherited(super, klass);
    (1-1/1)