diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-03-20 14:00:07 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-03-20 14:00:07 +0000 |
commit | ed224698b56a06808c98b1db393eea5b84a20f09 (patch) | |
tree | 9f48b9029c278368999ae05236a5ddde897f622c /marshal.c | |
parent | 42a81120e510c2c2fb7822ff4d5738db6ba392bf (diff) | |
download | ruby-ed224698b56a06808c98b1db393eea5b84a20f09.tar.gz |
* marshal.c (w_extended): erroneous check condition when dump
method is defined. [ruby-core:10646]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'marshal.c')
-rw-r--r-- | marshal.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -343,8 +343,8 @@ w_extended(VALUE klass, struct dump_arg *arg, int check) { char *path; - if (FL_TEST(klass, FL_SINGLETON)) { - if (check && RCLASS(klass)->m_tbl->num_entries || + if (check && FL_TEST(klass, FL_SINGLETON)) { + if (RCLASS(klass)->m_tbl->num_entries || (RCLASS(klass)->iv_tbl && RCLASS(klass)->iv_tbl->num_entries > 1)) { rb_raise(rb_eTypeError, "singleton can't be dumped"); } @@ -610,13 +610,13 @@ w_object(VALUE obj, struct dump_arg *arg, int limit) { VALUE v; - w_class(TYPE_DATA, obj, arg, Qtrue); if (!rb_respond_to(obj, s_dump_data)) { rb_raise(rb_eTypeError, "no marshal_dump is defined for class %s", rb_obj_classname(obj)); } v = rb_funcall(obj, s_dump_data, 0); + w_class(TYPE_DATA, obj, arg, Qtrue); w_object(v, arg, limit); } break; @@ -1198,7 +1198,7 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod) VALUE data; v = rb_obj_alloc(klass); - if (! NIL_P(extmod)) { + if (!NIL_P(extmod)) { while (RARRAY_LEN(extmod) > 0) { VALUE m = rb_ary_pop(extmod); rb_extend_object(v, m); |