[前][次][番号順一覧][スレッド一覧]

ruby-changes:25630

From: nagachika <ko1@a...>
Date: Sat, 17 Nov 2012 00:56:14 +0900 (JST)
Subject: [ruby-changes:25630] nagachika:r37687 (trunk): * marshal.c (w_object): add flonum to arg->data to keep reference index

nagachika	2012-11-17 00:55:59 +0900 (Sat, 17 Nov 2012)

  New Revision: 37687

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37687

  Log:
    * marshal.c (w_object): add flonum to arg->data to keep reference index
      consistency. [ruby-core:49323] [Bug #7348]
    
    * test/ruby/test_marshal.rb: add a test for above.

  Modified files:
    trunk/ChangeLog
    trunk/marshal.c
    trunk/test/ruby/test_marshal.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 37686)
+++ ChangeLog	(revision 37687)
@@ -1,3 +1,10 @@
+Sat Nov 17 00:50:23 2012  CHIKANAGA Tomoyuki  <nagachika@r...>
+
+	* marshal.c (w_object): add flonum to arg->data to keep reference index
+	  consistency. [ruby-core:49323] [Bug #7348]
+
+	* test/ruby/test_marshal.rb: add a test for above.
+
 Sat Nov 17 00:40:25 2012  Nobuyoshi Nakada  <nobu@r...>
 
 	* common.mk (incs): dist files need probes.dmyh.
Index: marshal.c
===================================================================
--- marshal.c	(revision 37686)
+++ marshal.c	(revision 37687)
@@ -637,6 +637,7 @@
 	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);
     }
Index: test/ruby/test_marshal.rb
===================================================================
--- test/ruby/test_marshal.rb	(revision 37686)
+++ test/ruby/test_marshal.rb	(revision 37687)
@@ -492,4 +492,11 @@
     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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]