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

ruby-changes:11857

From: yugui <ko1@a...>
Date: Thu, 21 May 2009 23:48:23 +0900 (JST)
Subject: [ruby-changes:11857] Ruby:r23513 (ruby_1_9_1): merges r23361 from trunk into ruby_1_9_1.

yugui	2009-05-21 23:47:11 +0900 (Thu, 21 May 2009)

  New Revision: 23513

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

  Log:
    merges r23361 from trunk into ruby_1_9_1.
    --
    * array.c (rb_ary_flatten_bang): returns nil if nothing changed.
      a patch from Marc-Andre Lafortune in [ruby-core:23382].

  Modified files:
    branches/ruby_1_9_1/ChangeLog
    branches/ruby_1_9_1/array.c
    branches/ruby_1_9_1/test/ruby/test_array.rb
    branches/ruby_1_9_1/version.h

Index: ruby_1_9_1/array.c
===================================================================
--- ruby_1_9_1/array.c	(revision 23512)
+++ ruby_1_9_1/array.c	(revision 23513)
@@ -3190,7 +3190,7 @@
 
     rb_scan_args(argc, argv, "01", &lv);
     if (!NIL_P(lv)) level = NUM2INT(lv);
-    if (level == 0) return ary;
+    if (level == 0) return Qnil;
 
     result = flatten(ary, level, &mod);
     if (mod == 0) return Qnil;
Index: ruby_1_9_1/ChangeLog
===================================================================
--- ruby_1_9_1/ChangeLog	(revision 23512)
+++ ruby_1_9_1/ChangeLog	(revision 23513)
@@ -1,3 +1,8 @@
+Thu May  7 16:40:09 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* array.c (rb_ary_flatten_bang): returns nil if nothing changed.
+	  a patch from Marc-Andre Lafortune in [ruby-core:23382].
+
 Thu May  7 14:26:14 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* array.c (rb_ary_sample): negative sample number is invalid.
Index: ruby_1_9_1/version.h
===================================================================
--- ruby_1_9_1/version.h	(revision 23512)
+++ ruby_1_9_1/version.h	(revision 23513)
@@ -1,6 +1,6 @@
 #define RUBY_VERSION "1.9.1"
 #define RUBY_RELEASE_DATE "2009-05-12"
-#define RUBY_PATCHLEVEL 130
+#define RUBY_PATCHLEVEL 131
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 9
 #define RUBY_VERSION_TEENY 1
Index: ruby_1_9_1/test/ruby/test_array.rb
===================================================================
--- ruby_1_9_1/test/ruby/test_array.rb	(revision 23512)
+++ ruby_1_9_1/test/ruby/test_array.rb	(revision 23513)
@@ -736,11 +736,14 @@
 
     a5 = @cls[ a1, @cls[], a3 ]
     assert_equal(@cls[1, 2, 3, 4, 5, 6], a5.flatten!)
+    assert_nil(a5.flatten!(0), '[ruby-core:23382]')
     assert_equal(@cls[1, 2, 3, 4, 5, 6], a5)
 
     assert_equal(@cls[], @cls[].flatten)
     assert_equal(@cls[], 
                  @cls[@cls[@cls[@cls[],@cls[]],@cls[@cls[]],@cls[]],@cls[@cls[@cls[]]]].flatten)
+
+    assert_nil(@cls[].flatten!(0), '[ruby-core:23382]')
   end
 
   def test_flatten_with_callcc

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

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