mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* complex.c (nucomp_marshal_load): [ruby-core:45394]
* rational.c (nurat_marshal_load): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
82cd48d7ee
commit
89ae71d721
5 changed files with 23 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Sun Jun 3 10:23:32 2012 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
|
* complex.c (nucomp_marshal_load): [ruby-core:45394]
|
||||||
|
* rational.c (nurat_marshal_load): ditto.
|
||||||
|
|
||||||
Sun Jun 3 03:15:46 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
Sun Jun 3 03:15:46 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* regparse.c (onig_number_of_names): suppress a warning.
|
* regparse.c (onig_number_of_names): suppress a warning.
|
||||||
|
|
|
@ -1259,6 +1259,10 @@ static VALUE
|
||||||
nucomp_marshal_load(VALUE self, VALUE a)
|
nucomp_marshal_load(VALUE self, VALUE a)
|
||||||
{
|
{
|
||||||
get_dat1(self);
|
get_dat1(self);
|
||||||
|
|
||||||
|
rb_check_frozen(self);
|
||||||
|
rb_check_trusted(self);
|
||||||
|
|
||||||
Check_Type(a, T_ARRAY);
|
Check_Type(a, T_ARRAY);
|
||||||
if (RARRAY_LEN(a) != 2)
|
if (RARRAY_LEN(a) != 2)
|
||||||
rb_raise(rb_eArgError, "marshaled complex must have an array whose length is 2 but %ld", RARRAY_LEN(a));
|
rb_raise(rb_eArgError, "marshaled complex must have an array whose length is 2 but %ld", RARRAY_LEN(a));
|
||||||
|
|
|
@ -1605,6 +1605,10 @@ static VALUE
|
||||||
nurat_marshal_load(VALUE self, VALUE a)
|
nurat_marshal_load(VALUE self, VALUE a)
|
||||||
{
|
{
|
||||||
get_dat1(self);
|
get_dat1(self);
|
||||||
|
|
||||||
|
rb_check_frozen(self);
|
||||||
|
rb_check_trusted(self);
|
||||||
|
|
||||||
Check_Type(a, T_ARRAY);
|
Check_Type(a, T_ARRAY);
|
||||||
if (RARRAY_LEN(a) != 2)
|
if (RARRAY_LEN(a) != 2)
|
||||||
rb_raise(rb_eArgError, "marshaled rational must have an array whose length is 2 but %ld", RARRAY_LEN(a));
|
rb_raise(rb_eArgError, "marshaled rational must have an array whose length is 2 but %ld", RARRAY_LEN(a));
|
||||||
|
|
|
@ -661,6 +661,11 @@ class Complex_Test < Test::Unit::TestCase
|
||||||
assert_raise(TypeError, bug3656) {
|
assert_raise(TypeError, bug3656) {
|
||||||
Complex(1,2).marshal_load(0)
|
Complex(1,2).marshal_load(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c = Complex(1,2)
|
||||||
|
c.freeze
|
||||||
|
assert(c.frozen?)
|
||||||
|
assert_raise(RuntimeError){c.marshal_load([2,3])}
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_parse
|
def test_parse
|
||||||
|
|
|
@ -831,6 +831,11 @@ class Rational_Test < Test::Unit::TestCase
|
||||||
assert_raise(TypeError, bug3656) {
|
assert_raise(TypeError, bug3656) {
|
||||||
Rational(1,2).marshal_load(0)
|
Rational(1,2).marshal_load(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c = Rational(1,2)
|
||||||
|
c.freeze
|
||||||
|
assert(c.frozen?)
|
||||||
|
assert_raise(RuntimeError){c.marshal_load([2,3])}
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_parse
|
def test_parse
|
||||||
|
|
Loading…
Add table
Reference in a new issue