ruby-changes:50019
From: usa <ko1@a...>
Date: Wed, 31 Jan 2018 22:26:42 +0900 (JST)
Subject: [ruby-changes:50019] usa:r62137 (ruby_2_3): merge revision(s) 60060: [Backport #13950]
usa 2018-01-31 22:26:35 +0900 (Wed, 31 Jan 2018) New Revision: 62137 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62137 Log: merge revision(s) 60060: [Backport #13950] string.c: ASCII-incompatible is not ASCII only * string.c (tr_trans): ASCII-incompatible encoding strings cannot be ASCII-only even if valid. [ruby-core:83056] [Bug #13950] Modified directories: branches/ruby_2_3/ Modified files: branches/ruby_2_3/ChangeLog branches/ruby_2_3/string.c branches/ruby_2_3/test/ruby/test_string.rb branches/ruby_2_3/version.h Index: ruby_2_3/string.c =================================================================== --- ruby_2_3/string.c (revision 62136) +++ ruby_2_3/string.c (revision 62137) @@ -6109,7 +6109,7 @@ tr_trans(VALUE str, VALUE src, VALUE rep https://github.com/ruby/ruby/blob/trunk/ruby_2_3/string.c#L6109 } } - if (cr == ENC_CODERANGE_VALID) + if (cr == ENC_CODERANGE_VALID && rb_enc_asciicompat(e1)) cr = ENC_CODERANGE_7BIT; str_modify_keep_cr(str); s = RSTRING_PTR(str); send = RSTRING_END(str); Index: ruby_2_3/version.h =================================================================== --- ruby_2_3/version.h (revision 62136) +++ ruby_2_3/version.h (revision 62137) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1 #define RUBY_VERSION "2.3.7" #define RUBY_RELEASE_DATE "2018-01-31" -#define RUBY_PATCHLEVEL 398 +#define RUBY_PATCHLEVEL 399 #define RUBY_RELEASE_YEAR 2018 #define RUBY_RELEASE_MONTH 1 Index: ruby_2_3/test/ruby/test_string.rb =================================================================== --- ruby_2_3/test/ruby/test_string.rb (revision 62136) +++ ruby_2_3/test/ruby/test_string.rb (revision 62137) @@ -1723,8 +1723,13 @@ class TestString < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_string.rb#L1723 assert_equal(false, "\u3041\u3042".tr("\u3041", "a").ascii_only?) bug6156 = '[ruby-core:43335]' + bug13950 = '[ruby-core:83056] [Bug #13950]' str, range, star = %w[b a-z *].map{|s|s.encode("utf-16le")} - assert_equal(star, str.tr(range, star), bug6156) + result = str.tr(range, star) + assert_equal(star, result, bug6156) + assert_not_predicate(str, :ascii_only?) + assert_not_predicate(star, :ascii_only?) + assert_not_predicate(result, :ascii_only?, bug13950) end def test_tr! Index: ruby_2_3/ChangeLog =================================================================== --- ruby_2_3/ChangeLog (revision 62136) +++ ruby_2_3/ChangeLog (revision 62137) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1 +Wed Jan 31 22:26:13 2018 Nobuyoshi Nakada <nobu@r...> + + string.c: ASCII-incompatible is not ASCII only + + * string.c (tr_trans): ASCII-incompatible encoding strings cannot + be ASCII-only even if valid. [ruby-core:83056] [Bug #13950] + Wed Jan 31 22:24:05 2018 Nobuyoshi Nakada <nobu@r...> vm.c: fetch retval iff necessary Index: ruby_2_3 =================================================================== --- ruby_2_3 (revision 62136) +++ ruby_2_3 (revision 62137) Property changes on: ruby_2_3 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r60060 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/