Project

General

Profile

Bug #7348 » flonum_marshal_dump.patch

nagachika (Tomoyuki Chikanaga), 11/16/2012 02:38 PM

View differences:

marshal.c
w_symbol(SYM2ID(obj), arg);
}
else if (FLONUM_P(obj)) {
st_add_direct(arg->data, obj, arg->data->num_entries);
w_byte(TYPE_FLOAT, arg);
w_float(RFLOAT_VALUE(obj), arg);
}
test/ruby/test_marshal.rb
assert_equal(Rational(1, 2), Marshal.load("\x04\bU:\rRational[\ai\x06i\a"))
assert_raise(ArgumentError){Marshal.load("\x04\bU:\rRational[\bi\x00i\x00i\x00")}
end
def test_marshal_flonum_reference
bug7348 = '[ruby-core:49323]'
e = []
ary = [ [2.0, e], [e] ]
assert_equal(ary, Marshal.load(Marshal.dump(ary)), bug7348)
end
end
(2-2/2)