flonum_marshal_dump.patch

Tomoyuki Chikanaga, 11/16/2012 02:38 PM

Download (954 Bytes)

View differences:

marshal.c
637 637
	w_symbol(SYM2ID(obj), arg);
638 638
    }
639 639
    else if (FLONUM_P(obj)) {
640
	st_add_direct(arg->data, obj, arg->data->num_entries);
640 641
	w_byte(TYPE_FLOAT, arg);
641 642
	w_float(RFLOAT_VALUE(obj), arg);
642 643
    }
test/ruby/test_marshal.rb
492 492
    assert_equal(Rational(1, 2), Marshal.load("\x04\bU:\rRational[\ai\x06i\a"))
493 493
    assert_raise(ArgumentError){Marshal.load("\x04\bU:\rRational[\bi\x00i\x00i\x00")}
494 494
  end
495

  
496
  def test_marshal_flonum_reference
497
    bug7348 = '[ruby-core:49323]'
498
    e = []
499
    ary = [ [2.0, e], [e] ]
500
    assert_equal(ary, Marshal.load(Marshal.dump(ary)), bug7348)
501
  end
495 502
end