ruby-changes:21314
From: nobu <ko1@a...>
Date: Fri, 30 Sep 2011 03:18:14 +0900 (JST)
Subject: [ruby-changes:21314] nobu:r33363 (trunk): * array.c (ary_join_1): should not copy the encoding of non-string
nobu 2011-09-30 03:18:03 +0900 (Fri, 30 Sep 2011) New Revision: 33363 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33363 Log: * array.c (ary_join_1): should not copy the encoding of non-string element after string element. [ruby-core:39776] [Bug #5379] Modified files: trunk/ChangeLog trunk/array.c trunk/test/ruby/test_array.rb Index: array.c =================================================================== --- array.c (revision 33362) +++ array.c (revision 33363) @@ -1659,6 +1659,7 @@ case T_STRING: str_join: rb_str_buf_append(result, val); + *first = FALSE; break; case T_ARRAY: obj = val; Index: ChangeLog =================================================================== --- ChangeLog (revision 33362) +++ ChangeLog (revision 33363) @@ -1,3 +1,8 @@ +Thu Sep 29 13:17:51 2011 Nobuyoshi Nakada <nobu@r...> + + * array.c (ary_join_1): should not copy the encoding of non-string + element after string element. [ruby-core:39776] [Bug #5379] + Thu Sep 29 11:53:56 2011 Nobuyoshi Nakada <nobu@r...> * gc.c (slot_sweep, rb_gc_finalize_deferred) Index: test/ruby/test_array.rb =================================================================== --- test/ruby/test_array.rb (revision 33362) +++ test/ruby/test_array.rb (revision 33363) @@ -926,6 +926,8 @@ assert_equal(Encoding::US_ASCII, [1, [u]].join.encoding) assert_equal(Encoding::UTF_8, [u, [e]].join.encoding) assert_equal(Encoding::UTF_8, [u, [1]].join.encoding) + bug5379 = '[ruby-core:39776]' + assert_equal(Encoding::UTF_8, [[], u, nil].join.encoding, bug5379) ensure $, = nil end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/