diff options
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -684,10 +684,14 @@ static VALUE rb_class_allocate_instance(klass) VALUE klass; { - NEWOBJ(obj, struct RObject); - OBJSETUP(obj, klass, T_OBJECT); - - return (VALUE)obj; + if (rb_frame_last_func() != alloc) { + return rb_obj_alloc(klass); + } + else { + NEWOBJ(obj, struct RObject); + OBJSETUP(obj, klass, T_OBJECT); + return (VALUE)obj; + } } VALUE |