summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-09-04 06:37:39 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-09-04 06:37:39 +0000
commit64901cd69beb7b965b7d9e685b5fcdb835362c50 (patch)
treee979c50333db286795cf1e9db8d53fe6aee86070 /object.c
parent056817564e8fcf98a35a1f52a4d4d1d0ca6a9fe4 (diff)
* class.c (rb_make_metaclass): obj.meta.super.meta should be equal
to obj.meta.meta.super (ruby-bugs-ja:PR#324). * parse.y (yylex): the warning message "invalid character syntax" was never issued. * marshal.c (r_bytes): do not use alloca (ruby-bugs:PR#382). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r--object.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/object.c b/object.c
index d26efe1..71f5e99 100644
--- a/object.c
+++ b/object.c
@@ -94,8 +94,12 @@ static void
copy_object(dest, obj)
VALUE dest, obj;
{
- RBASIC(dest)->flags &= ~(T_MASK|FL_EXIVAR|FL_TAINT);
+ if (OBJ_FROZEN(dest)) {
+ rb_raise(rb_eTypeError, "[bug] frozen object (%s) allocated", rb_class2name(CLASS_OF(dest)));
+ }
+ RBASIC(dest)->flags &= ~(T_MASK|FL_EXIVAR);
RBASIC(dest)->flags |= RBASIC(obj)->flags & (T_MASK|FL_EXIVAR|FL_TAINT);
+ rb_funcall(dest, become, 1, obj);
if (FL_TEST(obj, FL_EXIVAR)) {
rb_copy_generic_ivar(dest, obj);
}
@@ -123,10 +127,9 @@ rb_obj_clone(obj)
rb_raise(rb_eTypeError, "can't clone %s", rb_class2name(CLASS_OF(obj)));
}
clone = rb_obj_alloc(rb_obj_class(obj));
- RBASIC(clone)->klass = rb_singleton_class_clone(obj);
copy_object(clone, obj);
- rb_funcall(clone, become, 1, obj);
- RBASIC(clone)->flags = RBASIC(obj)->flags;
+ RBASIC(clone)->klass = rb_singleton_class_clone(obj);
+ RBASIC(clone)->flags = RBASIC(obj)->flags | FL_TEST(clone, FL_TAINT);
return clone;
}
@@ -142,7 +145,6 @@ rb_obj_dup(obj)
}
dup = rb_obj_alloc(rb_obj_class(obj));
copy_object(dup, obj);
- rb_funcall(dup, become, 1, obj);
return dup;
}