summaryrefslogtreecommitdiffstats
path: root/object.c
diff options
context:
space:
mode:
Diffstat (limited to 'object.c')
-rw-r--r--object.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/object.c b/object.c
index 6b6f1b5ab..13ae657ee 100644
--- a/object.c
+++ b/object.c
@@ -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