diff options
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -3589,6 +3589,7 @@ rb_eval(self, n) { VALUE super, klass, tmp, cbase; ID cname; + int gen = Qfalse; if (NIL_P(ruby_cbase)) { rb_raise(rb_eTypeError, "no outer class/module"); @@ -3625,12 +3626,15 @@ rb_eval(self, n) klass = rb_define_class_id(cname, super); rb_set_class_path(klass, cbase, rb_id2name(cname)); rb_const_set(cbase, cname, klass); + gen = Qtrue; } if (ruby_wrapper) { rb_extend_object(klass, ruby_wrapper); rb_include_module(klass, ruby_wrapper); } - if (super) rb_class_inherited(super, klass); + if (super && gen) { + rb_class_inherited(super, klass); + } result = module_setup(klass, node); } break; @@ -5596,12 +5600,12 @@ eval(self, src, scope, file, line) if (strcmp(file, "(eval)") == 0) { VALUE mesg, errat; + errat = get_backtrace(ruby_errinfo); mesg = rb_attr_get(ruby_errinfo, rb_intern("mesg")); if (!NIL_P(mesg) && TYPE(mesg) == T_STRING) { - errat = get_backtrace(ruby_errinfo); rb_str_update(mesg, 0, 0, RARRAY(errat)->ptr[0]); - RARRAY(errat)->ptr[0] = RARRAY(backtrace(-2))->ptr[0]; } + RARRAY(errat)->ptr[0] = RARRAY(backtrace(-2))->ptr[0]; } rb_exc_raise(ruby_errinfo); } |