Skip to content

Commit

Permalink
should check the argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Watson1978 committed Jul 15, 2012
1 parent 851f216 commit a2f9d49
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions class.c
Expand Up @@ -779,6 +779,7 @@ rb_mod_included_modules(VALUE mod)
VALUE
rb_mod_include_p(VALUE mod, SEL sel, VALUE mod2)
{
Check_Type(mod2, T_MODULE);
return rb_ary_includes(rb_mod_included_modules(mod), mod2);
}

Expand Down
8 changes: 4 additions & 4 deletions complex.c
Expand Up @@ -1322,10 +1322,10 @@ static VALUE
nucomp_marshal_load(VALUE self, SEL sel, VALUE a)
{
get_dat1(self);
VALUE ary = rb_convert_type(a, T_ARRAY, "Array", "to_ary");
GC_WB(&dat->real, RARRAY_AT(ary, 0));
GC_WB(&dat->imag, RARRAY_AT(ary, 1));
rb_copy_generic_ivar(self, ary);
Check_Type(a, T_ARRAY);
GC_WB(&dat->real, RARRAY_AT(a, 0));
GC_WB(&dat->imag, RARRAY_AT(a, 1));
rb_copy_generic_ivar(self, a);
return self;
}

Expand Down
9 changes: 5 additions & 4 deletions rational.c
Expand Up @@ -1583,10 +1583,11 @@ static VALUE
nurat_marshal_load(VALUE self, SEL sel, VALUE a)
{
get_dat1(self);
VALUE ary = rb_convert_type(a, T_ARRAY, "Array", "to_ary");
GC_WB(&dat->num, RARRAY_AT(ary, 0));
GC_WB(&dat->den, RARRAY_AT(ary ,1));
rb_copy_generic_ivar(self, ary);
Check_Type(a, T_ARRAY);
GC_WB(&dat->num, RARRAY_AT(a, 0));
GC_WB(&dat->den, RARRAY_AT(a ,1));
rb_copy_generic_ivar(self, a);

if (f_zero_p(dat->den)) {
rb_raise_zerodiv();
}
Expand Down
1 change: 0 additions & 1 deletion spec/frozen/tags/macruby/core/module/include_tags.txt
Expand Up @@ -2,4 +2,3 @@ fails:Module#include adds all ancestor modules when a previously included module
fails:Module#include doesn't include module if it is included in a super class
fails:Module#include recursively includes new mixins
fails:Module#include preserves ancestor order
fails:Module#include? raises a TypeError when no module was given

0 comments on commit a2f9d49

Please sign in to comment.