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

ruby-changes:16305

From: yugui <ko1@a...>
Date: Fri, 11 Jun 2010 13:21:36 +0900 (JST)
Subject: [ruby-changes:16305] Ruby:r28277 (ruby_1_9_2): merges r28187 and r28189 from trunk into ruby_1_9_2.

yugui	2010-06-11 13:21:18 +0900 (Fri, 11 Jun 2010)

  New Revision: 28277

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

  Log:
    merges r28187 and r28189 from trunk into ruby_1_9_2.
    --
    * array.c (rb_ary_product): clear uninitialized elements in temporary
      array.
    --
    * test/ruby/test_array.rb (test_product): test for r28187.

  Modified files:
    branches/ruby_1_9_2/ChangeLog
    branches/ruby_1_9_2/array.c
    branches/ruby_1_9_2/test/ruby/test_array.rb

Index: ruby_1_9_2/array.c
===================================================================
--- ruby_1_9_2/array.c	(revision 28276)
+++ ruby_1_9_2/array.c	(revision 28277)
@@ -4308,6 +4308,7 @@
     /* initialize the arrays of arrays */
     ARY_SET_LEN(t0, n);
     arrays[0] = ary;
+    for (i = 1; i < n; i++) arrays[i] = Qnil;
     for (i = 1; i < n; i++) arrays[i] = to_ary(argv[i-1]);
 
     /* initialize the counters for the arrays */
Index: ruby_1_9_2/ChangeLog
===================================================================
--- ruby_1_9_2/ChangeLog	(revision 28276)
+++ ruby_1_9_2/ChangeLog	(revision 28277)
@@ -1,3 +1,8 @@
+Sun Jun  6 19:55:21 2010  Tanaka Akira  <akr@f...>
+
+	* array.c (rb_ary_product): clear uninitialized elements in temporary
+	  array.
+
 Sat Jun  5 06:20:57 2010  Eric Hodel  <drbrain@s...>
 
 	* dir.c: Clarification of what '*' matches.  Patch by John Wells
Index: ruby_1_9_2/test/ruby/test_array.rb
===================================================================
--- ruby_1_9_2/test/ruby/test_array.rb	(revision 28276)
+++ ruby_1_9_2/test/ruby/test_array.rb	(revision 28277)
@@ -1523,6 +1523,11 @@
     assert_equal([[1, 3, 6], [1, 3, 8], [1, 4, 6], [1, 4, 8], [1, 5, 6], [1, 5, 8],
                   [2, 3, 6], [2, 3, 8], [2, 4, 6], [2, 4, 8], [2, 5, 6], [2, 5, 8]],
                  acc, bug3394)
+
+    def (o = Object.new).to_ary; GC.start; [3,4] end
+    acc = [1,2].product(*[o]*10)
+    assert_equal([1,2].product([3,4], [3,4], [3,4], [3,4], [3,4], [3,4], [3,4], [3,4], [3,4], [3,4]),
+                 acc)
   end
 
   def test_permutation

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

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